@@ -834,6 +834,11 @@ async def test_on_message_send_non_blocking():
834834
835835 assert task is not None
836836 assert task .status .state == TaskState .completed
837+ assert (
838+ result .history
839+ and task .history
840+ and len (result .history ) == len (task .history )
841+ )
837842
838843
839844@pytest .mark .asyncio
@@ -855,7 +860,7 @@ async def test_on_message_send_limit_history():
855860 configuration = MessageSendConfiguration (
856861 blocking = True ,
857862 accepted_output_modes = ['text/plain' ],
858- history_length = 0 ,
863+ history_length = 1 ,
859864 ),
860865 )
861866
@@ -866,17 +871,17 @@ async def test_on_message_send_limit_history():
866871 # verify that history_length is honored
867872 assert result is not None
868873 assert isinstance (result , Task )
869- assert result .history is not None and len (result .history ) == 0
874+ assert result .history is not None and len (result .history ) == 1
870875 assert result .status .state == TaskState .completed
871876
872877 # verify that history is still persisted to the store
873878 task = await task_store .get (result .id )
874879 assert task is not None
875- assert task .history is not None and len (task .history ) > 0
880+ assert task .history is not None and len (task .history ) > 1
876881
877882
878883@pytest .mark .asyncio
879- async def test_on_task_get_limit_history ():
884+ async def test_on_get_task_limit_history ():
880885 task_store = InMemoryTaskStore ()
881886 push_store = InMemoryPushNotificationConfigStore ()
882887
@@ -892,7 +897,8 @@ async def test_on_task_get_limit_history():
892897 parts = [Part (root = TextPart (text = 'Hi' ))],
893898 ),
894899 configuration = MessageSendConfiguration (
895- blocking = True , accepted_output_modes = ['text/plain' ]
900+ blocking = True ,
901+ accepted_output_modes = ['text/plain' ],
896902 ),
897903 )
898904
@@ -904,14 +910,14 @@ async def test_on_task_get_limit_history():
904910 assert isinstance (result , Task )
905911
906912 get_task_result = await request_handler .on_get_task (
907- TaskQueryParams (id = result .id , history_length = 0 ),
913+ TaskQueryParams (id = result .id , history_length = 1 ),
908914 create_server_call_context (),
909915 )
910916 assert get_task_result is not None
911917 assert isinstance (get_task_result , Task )
912918 assert (
913919 get_task_result .history is not None
914- and len (get_task_result .history ) == 0
920+ and len (get_task_result .history ) == 1
915921 )
916922
917923
0 commit comments