Skip to content

Commit c93f369

Browse files
kikifrostcopybara-github
authored andcommitted
test: remove obsolete shadowed instruction tests
Merge #6922 PiperOrigin-RevId: 974061113
1 parent 8aaf62a commit c93f369

1 file changed

Lines changed: 0 additions & 101 deletions

File tree

tests/unittests/models/test_llm_request.py

Lines changed: 0 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -187,107 +187,6 @@ def test_append_instructions_with_string_list_multiple_calls():
187187
assert request.config.system_instruction == expected
188188

189189

190-
def test_append_instructions_with_content():
191-
"""Test that append_instructions works with types.Content (new behavior)."""
192-
request = LlmRequest()
193-
194-
# Create a Content object
195-
content = types.Content(
196-
role='user', parts=[types.Part(text='This is content-based instruction')]
197-
)
198-
199-
# Append content
200-
request.append_instructions(content)
201-
202-
# Should be set as system_instruction
203-
assert len(request.contents) == 0
204-
assert request.config.system_instruction == content
205-
206-
207-
def test_append_instructions_with_content_multiple_calls():
208-
"""Test multiple calls to append_instructions with Content objects."""
209-
request = LlmRequest()
210-
211-
# Add some existing content first
212-
existing_content = types.Content(
213-
role='user', parts=[types.Part(text='Existing content')]
214-
)
215-
request.contents.append(existing_content)
216-
217-
# First Content instruction
218-
content1 = types.Content(
219-
role='user', parts=[types.Part(text='First instruction')]
220-
)
221-
request.append_instructions(content1)
222-
223-
# Should be set as system_instruction, existing content unchanged
224-
assert len(request.contents) == 1
225-
assert request.contents[0] == existing_content
226-
assert request.config.system_instruction == content1
227-
228-
# Second Content instruction
229-
content2 = types.Content(
230-
role='user', parts=[types.Part(text='Second instruction')]
231-
)
232-
request.append_instructions(content2)
233-
234-
# Second Content should be merged with first in system_instruction
235-
assert len(request.contents) == 1
236-
assert request.contents[0] == existing_content
237-
assert isinstance(request.config.system_instruction, types.Content)
238-
assert len(request.config.system_instruction.parts) == 2
239-
assert request.config.system_instruction.parts[0].text == 'First instruction'
240-
assert request.config.system_instruction.parts[1].text == 'Second instruction'
241-
242-
243-
def test_append_instructions_with_content_multipart():
244-
"""Test append_instructions with Content containing multiple parts."""
245-
request = LlmRequest()
246-
247-
# Create Content with multiple parts (text and potentially files)
248-
content = types.Content(
249-
role='user',
250-
parts=[
251-
types.Part(text='Text instruction'),
252-
types.Part(text='Additional text part'),
253-
],
254-
)
255-
256-
request.append_instructions(content)
257-
258-
assert len(request.contents) == 0
259-
assert request.config.system_instruction == content
260-
assert len(request.config.system_instruction.parts) == 2
261-
assert request.config.system_instruction.parts[0].text == 'Text instruction'
262-
assert (
263-
request.config.system_instruction.parts[1].text == 'Additional text part'
264-
)
265-
266-
267-
def test_append_instructions_mixed_string_and_content():
268-
"""Test mixing string list and Content instructions."""
269-
request = LlmRequest()
270-
271-
# First add string instructions
272-
request.append_instructions(['String instruction'])
273-
assert request.config.system_instruction == 'String instruction'
274-
275-
# Then add Content instruction
276-
content = types.Content(
277-
role='user', parts=[types.Part(text='Content instruction')]
278-
)
279-
request.append_instructions(content)
280-
281-
# String and Content should be merged in system_instruction
282-
assert len(request.contents) == 0
283-
assert isinstance(request.config.system_instruction, types.Content)
284-
assert len(request.config.system_instruction.parts) == 2
285-
assert request.config.system_instruction.parts[0].text == 'String instruction'
286-
assert (
287-
request.config.system_instruction.parts[1].text == 'Content instruction'
288-
)
289-
290-
291190
def test_append_instructions_empty_string_list():
292191
"""Test append_instructions with empty list of strings."""
293192
request = LlmRequest()

0 commit comments

Comments
 (0)