@@ -1330,7 +1330,7 @@ async def test_on_message_send_stream_rejects_multiple_messages():
13301330 parts = [Part (text = 'Hi' )],
13311331 )
13321332 )
1333- with pytest .raises (InvalidAgentResponseError ):
1333+ with pytest .raises (InvalidAgentResponseError , match = 'Multiple Message' ):
13341334 async for _ in request_handler .on_message_send_stream (
13351335 params , create_server_call_context ()
13361336 ):
@@ -1354,7 +1354,9 @@ async def test_on_message_send_stream_rejects_message_after_task_event():
13541354 parts = [Part (text = 'Hi' )],
13551355 )
13561356 )
1357- with pytest .raises (InvalidAgentResponseError ):
1357+ with pytest .raises (
1358+ InvalidAgentResponseError , match = 'Message object in task mode'
1359+ ):
13581360 async for _ in request_handler .on_message_send_stream (
13591361 params , create_server_call_context ()
13601362 ):
@@ -1378,7 +1380,7 @@ async def test_on_message_send_stream_rejects_task_event_after_message():
13781380 parts = [Part (text = 'Hi' )],
13791381 )
13801382 )
1381- with pytest .raises (InvalidAgentResponseError ):
1383+ with pytest .raises (InvalidAgentResponseError , match = 'in message mode' ):
13821384 async for _ in request_handler .on_message_send_stream (
13831385 params , create_server_call_context ()
13841386 ):
@@ -1402,7 +1404,9 @@ async def test_on_message_send_stream_rejects_event_after_terminal_state():
14021404 parts = [Part (text = 'Hi' )],
14031405 )
14041406 )
1405- with pytest .raises (InvalidAgentResponseError ):
1407+ with pytest .raises (
1408+ InvalidAgentResponseError , match = 'Message object in task mode'
1409+ ):
14061410 async for _ in request_handler .on_message_send_stream (
14071411 params , create_server_call_context ()
14081412 ):
0 commit comments