From e4febc228db4a59dfd9f0cfa5c9da60a428d3ab4 Mon Sep 17 00:00:00 2001 From: "ZOU Yi (BD/SWD-WDE1)" Date: Mon, 14 Sep 2026 11:26:31 +0800 Subject: [PATCH] test(sap): cover the non-dict final_result branch The isinstance guard added in the previous commit left one line uncovered, so patch coverage reported a miss on the new branch. A final_result that is not a dict is treated as an unknown event and skipped instead of reaching model_validate, and this pins that behavior. --- tests/test_litellm/llms/sap/chat/test_sap_chat_calls.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/test_litellm/llms/sap/chat/test_sap_chat_calls.py b/tests/test_litellm/llms/sap/chat/test_sap_chat_calls.py index 90b4b39582b..ee9589966a1 100644 --- a/tests/test_litellm/llms/sap/chat/test_sap_chat_calls.py +++ b/tests/test_litellm/llms/sap/chat/test_sap_chat_calls.py @@ -315,3 +315,10 @@ def test_to_openai_chunk_from_orchestration_result(): assert chunk is not None assert chunk.choices[0].delta.content == "Hello " assert chunk.choices[0].logprobs is None + + +def test_to_openai_chunk_ignores_non_dict_final_result(): + from litellm.llms.sap.chat.handler import _StreamParser + + assert _StreamParser.to_openai_chunk({"final_result": None}) is None + assert _StreamParser.to_openai_chunk({"final_result": "not-a-chunk"}) is None