From c6c61c8dddda9c4309f8d67a573c3351c892cf52 Mon Sep 17 00:00:00 2001 From: deepak7lal Date: Fri, 11 Sep 2026 01:06:17 +0530 Subject: [PATCH] test(tools): cover non-object JSON in concatenated arguments Codecov flagged the `not isinstance(obj, dict)` guard in `_split_complete_json_objects` as the one uncovered line in the patch. `{"a": 1}[1, 2]` decodes cleanly but yields a list, which must not be salvaged as tool arguments. Co-Authored-By: Claude Opus 5 --- .../test_litellm_core_utils_prompt_templates_common_utils.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/test_litellm/litellm_core_utils/prompt_templates/test_litellm_core_utils_prompt_templates_common_utils.py b/tests/test_litellm/litellm_core_utils/prompt_templates/test_litellm_core_utils_prompt_templates_common_utils.py index cf641113928..617a4055fe4 100644 --- a/tests/test_litellm/litellm_core_utils/prompt_templates/test_litellm_core_utils_prompt_templates_common_utils.py +++ b/tests/test_litellm/litellm_core_utils/prompt_templates/test_litellm_core_utils_prompt_templates_common_utils.py @@ -315,6 +315,7 @@ def test_parse_tool_call_arguments_concatenated_is_not_dropped_silently(): '{"a": 1}{"b":', # truncated tail '{"a": 1} garbage', # trailing garbage '{"a": 1}{"b": 2} x', # complete objects followed by junk + '{"a": 1}[1, 2]', # valid JSON, but not an object ], ) def test_parse_tool_call_arguments_rejects_incomplete_concatenation(raw):