@@ -56,10 +56,7 @@ async def test_sampling_tool(message: str):
5656 result = await client_session .call_tool ("test_sampling" , {"message" : "Test message for sampling" })
5757 assert result .isError is True
5858 assert isinstance (result .content [0 ], TextContent )
59- assert (
60- result .content [0 ].text
61- == "Error executing tool test_sampling: Sampling not supported"
62- )
59+ assert result .content [0 ].text == "Error executing tool test_sampling: Sampling not supported"
6360
6461
6562@pytest .mark .anyio
@@ -122,9 +119,7 @@ async def make_sampling_call(call_id: str, delay: float):
122119 # Start operations with out-of-order timing
123120 tg .start_soon (make_sampling_call , "slow_call" , 0.6 ) # Should finish last
124121 tg .start_soon (make_sampling_call , "fast_call" , 0.2 ) # Should finish first
125- tg .start_soon (
126- make_sampling_call , "medium_call" , 0.4
127- ) # Should finish middle
122+ tg .start_soon (make_sampling_call , "medium_call" , 0.4 ) # Should finish middle
128123
129124 # Combine results to show all completed
130125 combined_response = " | " .join (
@@ -138,19 +133,15 @@ async def make_sampling_call(call_id: str, delay: float):
138133 return combined_response
139134
140135 # Test concurrent sampling calls with time-sort verification
141- async with create_session (
142- server ._mcp_server , sampling_callback = sampling_callback
143- ) as client_session :
136+ async with create_session (server ._mcp_server , sampling_callback = sampling_callback ) as client_session :
144137 # Make a request that triggers multiple concurrent sampling calls
145138 result = await client_session .call_tool ("concurrent_sampling_tool" , {})
146139
147140 assert result .isError is False
148141 assert isinstance (result .content [0 ], TextContent )
149142
150143 # Verify all sampling calls completed with expected responses
151- expected_result = (
152- "Response after 0.6s | Response after 0.2s | Response after 0.4s"
153- )
144+ expected_result = "Response after 0.6s | Response after 0.2s | Response after 0.4s"
154145 assert result .content [0 ].text == expected_result
155146
156147 # Key test: verify concurrent execution using time-sort
0 commit comments