Skip to content

Commit 97c9fe5

Browse files
committed
test: applying additional Gemini's suggestions
1 parent ed7cff4 commit 97c9fe5

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

tests/client/test_card_resolver.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ async def test_get_agent_card_validation_error(
269269
mock_response,
270270
valid_agent_card_data,
271271
):
272-
"""Test that empty string relative_card_path uses default path."""
272+
"""Test A2AClientJSONError is raised on agent card validation error."""
273273
return_json = {'invalid': 'data'}
274274
mock_response.json.return_value = return_json
275275
mock_httpx_client.get.return_value = mock_response
@@ -345,21 +345,21 @@ async def test_get_agent_card_empty_string_relative_path(
345345
f'{base_url}/{AGENT_CARD_WELL_KNOWN_PATH[1:]}',
346346
)
347347

348+
@pytest.mark.parametrize('status_code', [400, 401, 403, 500, 502])
348349
@pytest.mark.asyncio
349350
async def test_get_agent_card_different_status_codes(
350-
self, resolver, mock_httpx_client
351+
self, resolver, mock_httpx_client, status_code
351352
):
352353
"""Test different HTTP status codes raise appropriate errors."""
353-
for status_code in [400, 401, 403, 500, 502]:
354-
mock_response = Mock(spec=httpx.Response)
355-
mock_response.status_code = status_code
356-
mock_response.raise_for_status.side_effect = httpx.HTTPStatusError(
357-
f'Status {status_code}', request=Mock(), response=mock_response
358-
)
359-
mock_httpx_client.get.return_value = mock_response
360-
with pytest.raises(A2AClientHTTPError) as exc_info:
361-
await resolver.get_agent_card()
362-
assert exc_info.value.status_code == status_code
354+
mock_response = Mock(spec=httpx.Response)
355+
mock_response.status_code = status_code
356+
mock_response.raise_for_status.side_effect = httpx.HTTPStatusError(
357+
f'Status {status_code}', request=Mock(), response=mock_response
358+
)
359+
mock_httpx_client.get.return_value = mock_response
360+
with pytest.raises(A2AClientHTTPError) as exc_info:
361+
await resolver.get_agent_card()
362+
assert exc_info.value.status_code == status_code
363363

364364
@pytest.mark.asyncio
365365
async def test_get_agent_card_returns_agent_card_instance(

0 commit comments

Comments
 (0)