From f63348419bdf36795aca2e7fa932df30a30fff49 Mon Sep 17 00:00:00 2001 From: Holt Skinner Date: Thu, 24 Jul 2025 19:43:30 +0100 Subject: [PATCH 1/3] Add test for regular properties to not produce deprecationWarning --- tests/test_types.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/test_types.py b/tests/test_types.py index 3946a4d6..6c81ee29 100644 --- a/tests/test_types.py +++ b/tests/test_types.py @@ -1530,7 +1530,7 @@ def test_use_get_task_push_notification_params_for_request() -> None: ) -def test_camelCase() -> None: +def test_camelCase(recwarn) -> None: skill = AgentSkill( id='hello_world', name='Returns hello world', @@ -1551,8 +1551,14 @@ def test_camelCase() -> None: supportsAuthenticatedExtendedCard=True, ) + # Test accessing a standard property like 'version' should not produce a deprecation warning + version = agent_card.version + assert version == '1.0.0' + assert ( + not recwarn.list # Assert that no warnings were emitted during the access + ) + # 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 +1566,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'" ): From ffde0d786a38054479fe2edbec3d24824d167f17 Mon Sep 17 00:00:00 2001 From: Holt Skinner Date: Thu, 24 Jul 2025 20:06:24 +0100 Subject: [PATCH 2/3] Change check --- src/a2a/_base.py | 4 ++-- tests/test_types.py | 7 ------- 2 files changed, 2 insertions(+), 9 deletions(-) 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 6c81ee29..5f110c5f 100644 --- a/tests/test_types.py +++ b/tests/test_types.py @@ -1551,13 +1551,6 @@ def test_camelCase(recwarn) -> None: supportsAuthenticatedExtendedCard=True, ) - # Test accessing a standard property like 'version' should not produce a deprecation warning - version = agent_card.version - assert version == '1.0.0' - assert ( - not recwarn.list # Assert that no warnings were emitted during the access - ) - # Test setting an attribute via camelCase alias with pytest.warns( DeprecationWarning, From 6d57ae6d0ed650b2a07211d444930684e3c74085 Mon Sep 17 00:00:00 2001 From: Holt Skinner <13262395+holtskinner@users.noreply.github.com> Date: Thu, 24 Jul 2025 20:07:44 +0100 Subject: [PATCH 3/3] Update tests/test_types.py --- tests/test_types.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_types.py b/tests/test_types.py index 5f110c5f..5e693cee 100644 --- a/tests/test_types.py +++ b/tests/test_types.py @@ -1530,7 +1530,7 @@ def test_use_get_task_push_notification_params_for_request() -> None: ) -def test_camelCase(recwarn) -> None: +def test_camelCase() -> None: skill = AgentSkill( id='hello_world', name='Returns hello world',