From 3376a8464d82d7e6fec60bf36989a692ef380fd2 Mon Sep 17 00:00:00 2001 From: IvanShang <77005282+qdivan@users.noreply.github.com> Date: Fri, 21 Aug 2026 17:21:42 +0800 Subject: [PATCH] test(deepseek): exercise replay through request transform --- .../chat/test_deepseek_chat_transformation.py | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/tests/test_litellm/llms/deepseek/chat/test_deepseek_chat_transformation.py b/tests/test_litellm/llms/deepseek/chat/test_deepseek_chat_transformation.py index 9c4ceb5800b..ff1560ad9b2 100644 --- a/tests/test_litellm/llms/deepseek/chat/test_deepseek_chat_transformation.py +++ b/tests/test_litellm/llms/deepseek/chat/test_deepseek_chat_transformation.py @@ -106,7 +106,7 @@ async def test_async_transform_request_strips_unsupported_tools_from_body(): assert body["tools"][0]["function"]["name"] == "shell" -def test_fill_reasoning_content_warns_once_per_request_and_preserves_history(): +def test_transform_request_warns_once_per_replayed_history_and_preserves_history(): messages = [ {"role": "user", "content": "Use both tools."}, { @@ -130,17 +130,20 @@ def test_fill_reasoning_content_warns_once_per_request_and_preserves_history(): warning_path = "litellm.llms.deepseek.chat.transformation.litellm.verbose_logger.warning" with patch(warning_path) as warning: - first_result = config._fill_reasoning_content(messages) - warning.assert_called_once() + results = [ + config.transform_request( + model="deepseek-reasoner", + messages=messages, + optional_params={"thinking": {"type": "enabled"}}, + litellm_params={}, + headers={}, + ) + for _ in range(2) + ] - with patch(warning_path) as warning: - second_result = config._fill_reasoning_content(messages) - warning.assert_called_once() - - assert [first_result[index]["reasoning_content"] for index in (1, 3)] == [" ", " "] - assert [second_result[index]["reasoning_content"] for index in (1, 3)] == [" ", " "] - assert first_result[0] is messages[0] - assert second_result[4] is messages[4] + assert warning.call_count == 2 + for result in results: + assert [result["messages"][index]["reasoning_content"] for index in (1, 3)] == [" ", " "] assert messages == original_messages