From 69fd88449338f654f9456bde628a5298ba87cf98 Mon Sep 17 00:00:00 2001 From: sowmy narayanan Date: Sat, 5 Sep 2026 13:36:43 +0530 Subject: [PATCH] test(base_utils): cover an empty system message inside a block-content run Codecov flagged the empty-string branch of _text_blocks as the one line the PR left uncovered. The existing empty-string test only hits the plain-text join; this one forces the block path by merging an empty system message with a developer message that carries list content. --- tests/test_litellm/llms/base_llm/test_base_utils.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/test_litellm/llms/base_llm/test_base_utils.py b/tests/test_litellm/llms/base_llm/test_base_utils.py index 9e78d787d8e..d9a24f0b244 100644 --- a/tests/test_litellm/llms/base_llm/test_base_utils.py +++ b/tests/test_litellm/llms/base_llm/test_base_utils.py @@ -99,6 +99,17 @@ class TestHoistDeveloperMessagesIntoLeadingSystemMessage: ) ) == [{"role": "system", "content": "Rules"}] + def test_empty_string_message_adds_no_block_when_the_run_merges_as_blocks(self): + messages = [ + {"role": "system", "content": ""}, + {"role": "developer", "content": [{"type": "text", "text": "Rules"}]}, + {"role": "user", "content": "Hi"}, + ] + assert list(hoist_developer_messages_into_leading_system_message(messages)) == [ + {"role": "system", "content": [{"type": "text", "text": "Rules"}]}, + {"role": "user", "content": "Hi"}, + ] + def test_two_cached_string_messages_keep_one_breakpoint_each(self): messages = [ {"role": "system", "content": "A", "cache_control": {"type": "ephemeral", "ttl": "5m"}},