Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/a2a/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
(
Expand All @@ -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(
(
Expand Down
4 changes: 1 addition & 3 deletions tests/test_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -1530,7 +1530,7 @@ def test_use_get_task_push_notification_params_for_request() -> None:
)


def test_camelCase() -> None:
def test_camelCase(recwarn) -> None:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

In line with the PEP 8 style guide, Python function names should use snake_case. Please rename test_camelCase to test_camel_case for consistency and to adhere to this widely-accepted convention.

Suggested change
def test_camelCase(recwarn) -> None:
def test_camel_case(recwarn) -> None:

skill = AgentSkill(
id='hello_world',
name='Returns hello world',
Expand All @@ -1552,15 +1552,13 @@ 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'",
):
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'"
):
Expand Down
Loading