From d8f93b3ebddc71d1bdd5582be0a381849742591e Mon Sep 17 00:00:00 2001 From: Anas Khan <83116240+anxkhn@users.noreply.github.com> Date: Sat, 4 Jul 2026 18:38:26 +0530 Subject: [PATCH] test(models): re-enable finish_reason unknown-maps-to-OTHER litellm test test_finish_reason_unknown_maps_to_other was skipped during the v2.0.0 GA transition with reason "LiteLLM finish_reason mapping behaviour changed". That reason is now stale: _map_finish_reason ends with _FINISH_REASON_MAPPING.get(finish_reason_str, types.FinishReason.OTHER), so any unmapped finish_reason deterministically maps to OTHER regardless of LiteLLM's own normalization. The test bypasses that normalization with a mock returning a raw "totally_unknown_reason" and asserts the OTHER fallback. This skipped test is the only coverage of the _map_finish_reason -> OTHER fallback branch in the litellm suite, so the skip left a live production branch untested. Removing the skip restores that coverage with no production change; the test passes as-is. --- tests/unittests/models/test_litellm.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/unittests/models/test_litellm.py b/tests/unittests/models/test_litellm.py index 6f4341f55f..4b9daf8fe9 100644 --- a/tests/unittests/models/test_litellm.py +++ b/tests/unittests/models/test_litellm.py @@ -4984,7 +4984,6 @@ def test_model_response_to_generate_content_response_safety_finish_reason(): assert llm_response.error_message == "Finished with SAFETY" -@pytest.mark.skip(reason="LiteLLM finish_reason mapping behaviour changed") @pytest.mark.asyncio async def test_finish_reason_unknown_maps_to_other( mock_acompletion, lite_llm_instance