@@ -788,7 +788,9 @@ def tracking_streamablehttp_client(url):
788788 nonlocal connection_open_count
789789 connection_open_count += 1
790790 mock_http = MagicMock ()
791- mock_http .__aenter__ = AsyncMock (return_value = ("read" , "write" , lambda : None ))
791+ mock_http .__aenter__ = AsyncMock (
792+ return_value = ("read" , "write" , lambda : None )
793+ )
792794 mock_http .__aexit__ = AsyncMock ()
793795 return mock_http
794796
@@ -890,9 +892,7 @@ async def test_batch_call_tool_workload_not_found(self, mocker):
890892 )
891893
892894 with pytest .raises (ValueError , match = "not found" ):
893- await mcp_client .batch_call_tool (
894- "nonexistent" , "fetch" , [{"id" : 1 }]
895- )
895+ await mcp_client .batch_call_tool ("nonexistent" , "fetch" , [{"id" : 1 }])
896896
897897
898898@pytest .mark .asyncio
@@ -937,7 +937,9 @@ async def failing_on_third_call(*args, **kwargs):
937937 mock_http .__aexit__ = AsyncMock (return_value = None )
938938
939939 mocker .patch ("mcp_client.streamablehttp_client" , return_value = mock_http )
940- mocker .patch ("mcp_client.ClientSession" , return_value = mock_client_session_instance )
940+ mocker .patch (
941+ "mcp_client.ClientSession" , return_value = mock_client_session_instance
942+ )
941943
942944 call_args_list = [{"id" : i } for i in range (5 )]
943945
@@ -952,9 +954,9 @@ async def failing_on_third_call(*args, **kwargs):
952954 )
953955
954956 # Should report how many completed successfully
955- assert "2 successful" in error_msg . lower () or "2 completed" in error_msg . lower (), (
956- f"Error should mention 2 items completed successfully. Got: { error_msg } "
957- )
957+ assert (
958+ "2 successful" in error_msg . lower () or "2 completed" in error_msg . lower ()
959+ ), f"Error should mention 2 items completed successfully. Got: { error_msg } "
958960
959961 # Should report how many are still pending
960962 assert "2 pending" in error_msg .lower (), (
@@ -999,7 +1001,9 @@ async def failing_on_third_call(*args, **kwargs):
9991001 mock_http .__aexit__ = AsyncMock (return_value = None )
10001002
10011003 mocker .patch ("mcp_client.streamablehttp_client" , return_value = mock_http )
1002- mocker .patch ("mcp_client.ClientSession" , return_value = mock_client_session_instance )
1004+ mocker .patch (
1005+ "mcp_client.ClientSession" , return_value = mock_client_session_instance
1006+ )
10031007
10041008 call_args_list = [{"url" : f"http://example.com/{ i } " } for i in range (5 )]
10051009
@@ -1057,7 +1061,9 @@ async def hanging_call_tool(*args, **kwargs):
10571061 mock_http .__aexit__ = AsyncMock (return_value = None )
10581062
10591063 mocker .patch ("mcp_client.streamablehttp_client" , return_value = mock_http )
1060- mocker .patch ("mcp_client.ClientSession" , return_value = mock_client_session_instance )
1064+ mocker .patch (
1065+ "mcp_client.ClientSession" , return_value = mock_client_session_instance
1066+ )
10611067
10621068 # Verify DEFAULT_TOOL_TIMEOUT constant exists
10631069 assert hasattr (mcp_client , "DEFAULT_TOOL_TIMEOUT" ), (
@@ -1068,6 +1074,7 @@ async def hanging_call_tool(*args, **kwargs):
10681074 test_timeout = 0.5
10691075
10701076 import time
1077+
10711078 start = time .time ()
10721079
10731080 with pytest .raises (asyncio .TimeoutError ):
@@ -1118,12 +1125,15 @@ async def hanging_call_tool(*args, **kwargs):
11181125 mock_http .__aexit__ = AsyncMock (return_value = None )
11191126
11201127 mocker .patch ("mcp_client.streamablehttp_client" , return_value = mock_http )
1121- mocker .patch ("mcp_client.ClientSession" , return_value = mock_client_session_instance )
1128+ mocker .patch (
1129+ "mcp_client.ClientSession" , return_value = mock_client_session_instance
1130+ )
11221131
11231132 # Use a short timeout for testing (0.5 seconds)
11241133 test_timeout = 0.5
11251134
11261135 import time
1136+
11271137 start = time .time ()
11281138
11291139 # batch_call_tool wraps timeout errors in RuntimeError with progress info
0 commit comments