From 92f233faa34eb39f114803161149baefede86ae2 Mon Sep 17 00:00:00 2001 From: kikifrost <76505224+kikifrost@users.noreply.github.com> Date: Thu, 27 Aug 2026 01:36:18 -0700 Subject: [PATCH] test(models): remove obsolete shadowed instruction tests Four superseded append_instructions tests were hidden by later definitions with the same names. Remove the obsolete copies so the collected tests reflect the current string-only behavior. --- tests/unittests/models/test_llm_request.py | 101 --------------------- 1 file changed, 101 deletions(-) diff --git a/tests/unittests/models/test_llm_request.py b/tests/unittests/models/test_llm_request.py index 742beefde1e..0197bca7da0 100644 --- a/tests/unittests/models/test_llm_request.py +++ b/tests/unittests/models/test_llm_request.py @@ -187,107 +187,6 @@ def test_append_instructions_with_string_list_multiple_calls(): assert request.config.system_instruction == expected -def test_append_instructions_with_content(): - """Test that append_instructions works with types.Content (new behavior).""" - request = LlmRequest() - - # Create a Content object - content = types.Content( - role='user', parts=[types.Part(text='This is content-based instruction')] - ) - - # Append content - request.append_instructions(content) - - # Should be set as system_instruction - assert len(request.contents) == 0 - assert request.config.system_instruction == content - - -def test_append_instructions_with_content_multiple_calls(): - """Test multiple calls to append_instructions with Content objects.""" - request = LlmRequest() - - # Add some existing content first - existing_content = types.Content( - role='user', parts=[types.Part(text='Existing content')] - ) - request.contents.append(existing_content) - - # First Content instruction - content1 = types.Content( - role='user', parts=[types.Part(text='First instruction')] - ) - request.append_instructions(content1) - - # Should be set as system_instruction, existing content unchanged - assert len(request.contents) == 1 - assert request.contents[0] == existing_content - assert request.config.system_instruction == content1 - - # Second Content instruction - content2 = types.Content( - role='user', parts=[types.Part(text='Second instruction')] - ) - request.append_instructions(content2) - - # Second Content should be merged with first in system_instruction - assert len(request.contents) == 1 - assert request.contents[0] == existing_content - assert isinstance(request.config.system_instruction, types.Content) - assert len(request.config.system_instruction.parts) == 2 - assert request.config.system_instruction.parts[0].text == 'First instruction' - assert request.config.system_instruction.parts[1].text == 'Second instruction' - - -def test_append_instructions_with_content_multipart(): - """Test append_instructions with Content containing multiple parts.""" - request = LlmRequest() - - # Create Content with multiple parts (text and potentially files) - content = types.Content( - role='user', - parts=[ - types.Part(text='Text instruction'), - types.Part(text='Additional text part'), - ], - ) - - request.append_instructions(content) - - assert len(request.contents) == 0 - assert request.config.system_instruction == content - assert len(request.config.system_instruction.parts) == 2 - assert request.config.system_instruction.parts[0].text == 'Text instruction' - assert ( - request.config.system_instruction.parts[1].text == 'Additional text part' - ) - - -def test_append_instructions_mixed_string_and_content(): - """Test mixing string list and Content instructions.""" - request = LlmRequest() - - # First add string instructions - request.append_instructions(['String instruction']) - assert request.config.system_instruction == 'String instruction' - - # Then add Content instruction - content = types.Content( - role='user', parts=[types.Part(text='Content instruction')] - ) - request.append_instructions(content) - - # String and Content should be merged in system_instruction - assert len(request.contents) == 0 - assert isinstance(request.config.system_instruction, types.Content) - assert len(request.config.system_instruction.parts) == 2 - assert request.config.system_instruction.parts[0].text == 'String instruction' - assert ( - request.config.system_instruction.parts[1].text == 'Content instruction' - ) - - def test_append_instructions_empty_string_list(): """Test append_instructions with empty list of strings.""" request = LlmRequest()