Skip to content

Commit 2806f3e

Browse files
authored
fix: Remove DeprecationWarning for regular properties (#345)
1 parent c94d6aa commit 2806f3e

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

src/a2a/_base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def __setattr__(self, name: str, value: Any) -> None:
6464
# Get the map and find the corresponding snake_case field name.
6565
field_name = type(self)._get_alias_map().get(name) # noqa: SLF001
6666

67-
if field_name:
67+
if field_name and field_name != name:
6868
# An alias was used, issue a warning.
6969
warnings.warn(
7070
(
@@ -83,7 +83,7 @@ def __getattr__(self, name: str) -> Any:
8383
# Get the map and find the corresponding snake_case field name.
8484
field_name = type(self)._get_alias_map().get(name) # noqa: SLF001
8585

86-
if field_name:
86+
if field_name and field_name != name:
8787
# An alias was used, issue a warning.
8888
warnings.warn(
8989
(

tests/test_types.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1552,15 +1552,13 @@ def test_camelCase() -> None:
15521552
)
15531553

15541554
# Test setting an attribute via camelCase alias
1555-
# We expect a DeprecationWarning with a specific message
15561555
with pytest.warns(
15571556
DeprecationWarning,
15581557
match="Setting field 'supportsAuthenticatedExtendedCard'",
15591558
):
15601559
agent_card.supportsAuthenticatedExtendedCard = False
15611560

15621561
# Test getting an attribute via camelCase alias
1563-
# We expect another DeprecationWarning with a specific message
15641562
with pytest.warns(
15651563
DeprecationWarning, match="Accessing field 'defaultInputModes'"
15661564
):

0 commit comments

Comments
 (0)