@@ -111,9 +111,7 @@ def run_server_with_transport(module_name: str, port: int, transport: str) -> No
111111 else :
112112 raise ValueError (f"Invalid transport for test server: { transport } " )
113113
114- server = uvicorn .Server (
115- config = uvicorn .Config (app = app , host = "127.0.0.1" , port = port , log_level = "error" )
116- )
114+ server = uvicorn .Server (config = uvicorn .Config (app = app , host = "127.0.0.1" , port = port , log_level = "error" ))
117115 print (f"Starting { transport } server on port { port } " )
118116 server .run ()
119117
@@ -321,14 +319,10 @@ async def test_basic_prompts(server_transport: str, server_url: str) -> None:
321319
322320 # Test review_code prompt
323321 prompts = await session .list_prompts ()
324- review_prompt = next (
325- (p for p in prompts .prompts if p .name == "review_code" ), None
326- )
322+ review_prompt = next ((p for p in prompts .prompts if p .name == "review_code" ), None )
327323 assert review_prompt is not None
328324
329- prompt_result = await session .get_prompt (
330- "review_code" , {"code" : "def hello():\n print('Hello')" }
331- )
325+ prompt_result = await session .get_prompt ("review_code" , {"code" : "def hello():\n print('Hello')" })
332326 assert isinstance (prompt_result , GetPromptResult )
333327 assert len (prompt_result .messages ) == 1
334328 assert isinstance (prompt_result .messages [0 ].content , TextContent )
@@ -384,18 +378,16 @@ async def test_tool_progress(server_transport: str, server_url: str) -> None:
384378 assert result .capabilities .tools is not None
385379
386380 # Test long_running_task tool that reports progress
387- tool_result = await session .call_tool (
388- "long_running_task" , {"task_name" : "test" , "steps" : 3 }
389- )
381+ tool_result = await session .call_tool ("long_running_task" , {"task_name" : "test" , "steps" : 3 })
390382 assert len (tool_result .content ) == 1
391383 assert isinstance (tool_result .content [0 ], TextContent )
392384 assert "Task 'test' completed" in tool_result .content [0 ].text
393385
394386 # Verify that progress notifications or log messages were sent
395387 # Progress can come through either progress notifications or log messages
396- total_notifications = len (
397- notification_collector .progress_notifications
398- ) + len ( notification_collector . log_messages )
388+ total_notifications = len (notification_collector . progress_notifications ) + len (
389+ notification_collector .log_messages
390+ )
399391 assert total_notifications > 0
400392
401393
@@ -416,9 +408,7 @@ async def test_sampling(server_transport: str, server_url: str) -> None:
416408
417409 async with client_cm as client_streams :
418410 read_stream , write_stream = unpack_streams (client_streams )
419- async with ClientSession (
420- read_stream , write_stream , sampling_callback = sampling_callback
421- ) as session :
411+ async with ClientSession (read_stream , write_stream , sampling_callback = sampling_callback ) as session :
422412 # Test initialization
423413 result = await session .initialize ()
424414 assert isinstance (result , InitializeResult )
@@ -449,9 +439,7 @@ async def test_elicitation(server_transport: str, server_url: str) -> None:
449439
450440 async with client_cm as client_streams :
451441 read_stream , write_stream = unpack_streams (client_streams )
452- async with ClientSession (
453- read_stream , write_stream , elicitation_callback = elicitation_callback
454- ) as session :
442+ async with ClientSession (read_stream , write_stream , elicitation_callback = elicitation_callback ) as session :
455443 # Test initialization
456444 result = await session .initialize ()
457445 assert isinstance (result , InitializeResult )
@@ -497,9 +485,7 @@ async def test_completion(server_transport: str, server_url: str) -> None:
497485 assert len (prompts .prompts ) > 0
498486
499487 # Test getting a prompt
500- prompt_result = await session .get_prompt (
501- "review_code" , {"language" : "python" , "code" : "def test(): pass" }
502- )
488+ prompt_result = await session .get_prompt ("review_code" , {"language" : "python" , "code" : "def test(): pass" })
503489 assert len (prompt_result .messages ) > 0
504490
505491
0 commit comments