Skip to content

Commit bc87808

Browse files
committed
test(models): repair anthropic fallback regression assertions
Move the non-standard FunctionResponse assertions back into the regression test that exercises the fallback serialization path, and keep the PDF document test focused on document serialization only. Validated with pyink --check, the full anthropic_llm test file, and a runtime proof script covering both the fallback tool_result path and the PDF document path.
1 parent 4812d5e commit bc87808

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

tests/unittests/models/test_anthropic_llm.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -764,27 +764,28 @@ def test_part_to_message_block_with_non_standard_response():
764764
)
765765
part.function_response.id = "test_skill_id"
766766

767-
768-
def test_part_to_message_block_with_pdf_document():
769-
"""Test that part_to_message_block handles PDF document parts."""
770-
pdf_data = b"%PDF-1.4 fake pdf content"
771-
part = Part(
772-
inline_data=types.Blob(mime_type="application/pdf", data=pdf_data)
773-
)
774-
775767
result = part_to_message_block(part)
776768

777769
assert isinstance(result, dict)
778770
assert result["tool_use_id"] == "test_skill_id"
779771
assert result["type"] == "tool_result"
780772
assert not result["is_error"]
781-
# Content must be non-empty and contain the original data
782773
parsed = json.loads(result["content"])
783774
assert parsed["skill_name"] == "search_docs"
784775
assert parsed["instructions"] == "Use the search API to find documents."
785776
assert parsed["frontmatter"] == {"version": "1.0"}
786777

787778

779+
def test_part_to_message_block_with_pdf_document():
780+
"""Test that part_to_message_block handles PDF document parts."""
781+
pdf_data = b"%PDF-1.4 fake pdf content"
782+
part = Part(
783+
inline_data=types.Blob(mime_type="application/pdf", data=pdf_data)
784+
)
785+
786+
result = part_to_message_block(part)
787+
788+
assert isinstance(result, dict)
788789
assert result["type"] == "document"
789790
assert result["source"]["type"] == "base64"
790791
assert result["source"]["media_type"] == "application/pdf"

0 commit comments

Comments
 (0)