@@ -1136,11 +1136,15 @@ async def test_map_event_emits_end_event_for_last_chunk_without_tool_calls(self)
11361136 result = await mapper .map_event (last_chunk )
11371137
11381138 assert result is not None
1139- # Should have the end event
1139+ # Should have content part end event followed by message end event
1140+ content_part_end_event = result [- 2 ]
1141+ assert content_part_end_event .content_part is not None
1142+ assert content_part_end_event .content_part .end is not None
1143+ assert content_part_end_event .end is None
1144+
11401145 end_event = result [- 1 ]
11411146 assert end_event .end is not None
1142- assert end_event .content_part is not None
1143- assert end_event .content_part .end is not None
1147+ assert end_event .content_part is None
11441148
11451149 @pytest .mark .asyncio
11461150 async def test_map_event_emits_tool_call_start_events_on_last_chunk (self ):
@@ -1771,10 +1775,14 @@ async def test_emits_start_and_end_events(self):
17711775 assert start_event .content_part is not None
17721776 assert start_event .content_part .start is not None
17731777
1778+ content_part_end_event = result [- 2 ]
1779+ assert content_part_end_event .content_part is not None
1780+ assert content_part_end_event .content_part .end is not None
1781+ assert content_part_end_event .end is None
1782+
17741783 end_event = result [- 1 ]
17751784 assert end_event .end is not None
1776- assert end_event .content_part is not None
1777- assert end_event .content_part .end is not None
1785+ assert end_event .content_part is None
17781786
17791787 @pytest .mark .asyncio
17801788 async def test_emits_content_chunk_for_string_content (self ):
0 commit comments