99from httpx_sse import EventSource , ServerSentEvent
1010
1111from a2a .client import create_text_message_object
12+ from a2a .client .client import ClientCallContext
1213from a2a .client .errors import A2AClientError
1314from a2a .client .transports .rest import RestTransport
1415from a2a .extensions .common import HTTP_EXTENSION_HEADER
@@ -162,7 +163,6 @@ async def test_send_message_with_timeout_context(
162163 self , mock_httpx_client : AsyncMock , mock_agent_card : MagicMock
163164 ):
164165 """Test that send_message passes context timeout to build_request."""
165- from a2a .client .client import ClientCallContext
166166
167167 client = RestTransport (
168168 httpx_client = mock_httpx_client ,
@@ -258,7 +258,6 @@ async def test_send_message_with_default_extensions(
258258 mock_response .status_code = 200
259259 mock_httpx_client .send .return_value = mock_response
260260
261- from a2a .client .client import ClientCallContext
262261
263262 context = ClientCallContext (
264263 service_parameters = {
@@ -302,7 +301,6 @@ async def test_send_message_streaming_with_new_extensions(
302301 mock_event_source
303302 )
304303
305- from a2a .client .client import ClientCallContext
306304
307305 context = ClientCallContext (
308306 service_parameters = {
@@ -404,7 +402,6 @@ async def test_get_card_with_extended_card_support_with_extensions(
404402
405403 request = GetExtendedAgentCardRequest ()
406404
407- from a2a .client .client import ClientCallContext
408405
409406 context = ClientCallContext (
410407 service_parameters = {HTTP_EXTENSION_HEADER : extensions_str }
@@ -419,7 +416,6 @@ async def test_get_card_with_extended_card_support_with_extensions(
419416 await client .get_extended_agent_card (request , context = context )
420417
421418 mock_execute_request .assert_called_once ()
422- # _execute_request(method, target, tenant, context)
423419 call_args = mock_execute_request .call_args
424420 assert (
425421 call_args [1 ].get ('context' ) == context or call_args [0 ][3 ] == context
@@ -694,7 +690,8 @@ async def test_rest_get_task_prepend_empty_tenant(
694690 )
695691 @pytest .mark .asyncio
696692 @patch ('a2a.client.transports.http_helpers.aconnect_sse' )
697- async def test_rest_streaming_methods_prepend_tenant (
693+ async def test_rest_streaming_methods_prepend_tenant ( # noqa: PLR0913
694+
698695 self ,
699696 mock_aconnect_sse ,
700697 method_name ,
@@ -735,10 +732,7 @@ async def empty_aiter():
735732 args , kwargs = mock_aconnect_sse .call_args
736733 # method is 2nd positional argument
737734 assert args [1 ] == 'POST'
738- if method_name == 'subscribe' :
739- assert kwargs .get ('json' ) is None
740- else :
741- assert kwargs .get ('json' ) == json_format .MessageToDict (request_obj )
735+ assert kwargs .get ('json' ) == json_format .MessageToDict (request_obj )
742736
743737 # url is 3rd positional argument in aconnect_sse(client, method, url, ...)
744738 assert args [2 ] == f'http://agent.example.com/api{ expected_path } '
0 commit comments