diff --git a/src/a2a/_base.py b/src/a2a/_base.py index 81ce827d..fc100442 100644 --- a/src/a2a/_base.py +++ b/src/a2a/_base.py @@ -64,7 +64,7 @@ def __setattr__(self, name: str, value: Any) -> None: # Get the map and find the corresponding snake_case field name. field_name = type(self)._get_alias_map().get(name) # noqa: SLF001 - if field_name: + if field_name and field_name != name: # An alias was used, issue a warning. warnings.warn( ( @@ -83,7 +83,7 @@ def __getattr__(self, name: str) -> Any: # Get the map and find the corresponding snake_case field name. field_name = type(self)._get_alias_map().get(name) # noqa: SLF001 - if field_name: + if field_name and field_name != name: # An alias was used, issue a warning. warnings.warn( ( diff --git a/tests/test_types.py b/tests/test_types.py index 3946a4d6..5e693cee 100644 --- a/tests/test_types.py +++ b/tests/test_types.py @@ -1552,7 +1552,6 @@ def test_camelCase() -> None: ) # Test setting an attribute via camelCase alias - # We expect a DeprecationWarning with a specific message with pytest.warns( DeprecationWarning, match="Setting field 'supportsAuthenticatedExtendedCard'", @@ -1560,7 +1559,6 @@ def test_camelCase() -> None: agent_card.supportsAuthenticatedExtendedCard = False # Test getting an attribute via camelCase alias - # We expect another DeprecationWarning with a specific message with pytest.warns( DeprecationWarning, match="Accessing field 'defaultInputModes'" ):