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.
This commit is contained in:
sowmy narayanan 2026-09-05 13:36:43 +05:30 committed by mateo-berri
parent 20b3f1efed
commit 69fd884493

View file

@ -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"}},