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.
This commit is contained in:
ZOU Yi (BD/SWD-WDE1) 2026-09-14 11:26:31 +08:00
parent a215b78d99
commit e4febc228d

View file

@ -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