test fixes unit tests

This commit is contained in:
Ishaan Jaffer 2026-02-04 16:01:14 -08:00
parent 5a128144cf
commit d51574ee26
2 changed files with 22 additions and 22 deletions

View file

@ -876,4 +876,4 @@ def test_sync_openai_messages():
assert response is not None
assert isinstance(response, dict)
assert response["content"][0].text is not None
assert response["content"][0]["text"] is not None

View file

@ -341,10 +341,10 @@ def test_translate_openai_content_to_anthropic_empty_function_arguments():
result = adapter._translate_openai_content_to_anthropic(choices=openai_choices)
assert len(result) == 1
assert result[0].type == "tool_use"
assert result[0].id == "call_empty_args"
assert result[0].name == "test_function"
assert result[0].input == {}, "Empty function arguments should result in empty dict"
assert result[0]["type"] == "tool_use"
assert result[0]["id"] == "call_empty_args"
assert result[0]["name"] == "test_function"
assert result[0]["input"] == {}, "Empty function arguments should result in empty dict"
def test_translate_openai_content_to_anthropic_text_and_tool_calls():
@ -372,12 +372,12 @@ def test_translate_openai_content_to_anthropic_text_and_tool_calls():
result = adapter._translate_openai_content_to_anthropic(choices=openai_choices)
assert len(result) == 2
assert result[0].type == "text"
assert result[0].text == "Calling get_weather now."
assert result[1].type == "tool_use"
assert result[1].id == "call_weather"
assert result[1].name == "get_weather"
assert result[1].input == {"location": "Boston"}
assert result[0]["type"] == "text"
assert result[0]["text"] == "Calling get_weather now."
assert result[1]["type"] == "tool_use"
assert result[1]["id"] == "call_weather"
assert result[1]["name"] == "get_weather"
assert result[1]["input"] == {"location": "Boston"}
def test_translate_openai_response_to_anthropic_text_and_tool_calls():
@ -484,11 +484,11 @@ def test_translate_openai_content_to_anthropic_thinking_and_redacted_thinking():
result = adapter._translate_openai_content_to_anthropic(choices=openai_choices)
assert len(result) == 2
assert result[0].type == "thinking"
assert result[0].thinking == "I need to summar"
assert result[0].signature == "sigsig"
assert result[1].type == "redacted_thinking"
assert result[1].data == "REDACTED"
assert result[0]["type"] == "thinking"
assert result[0]["thinking"] == "I need to summar"
assert result[0]["signature"] == "sigsig"
assert result[1]["type"] == "redacted_thinking"
assert result[1]["data"] == "REDACTED"
def test_translate_streaming_openai_chunk_to_anthropic_with_thinking():
@ -1443,13 +1443,13 @@ def test_translate_openai_content_to_anthropic_reasoning_content_without_thinkin
assert len(result) == 2
# First block should be thinking block with reasoning_content
assert result[0].type == "thinking"
assert "Considering Letter Frequency" in result[0].thinking
assert "Calculating the Count" in result[0].thinking
assert result[0].signature is None
assert result[0]["type"] == "thinking"
assert "Considering Letter Frequency" in result[0]["thinking"]
assert "Calculating the Count" in result[0]["thinking"]
assert result[0]["signature"] is None
# Second block should be text block with content
assert result[1].type == "text"
assert result[1].text == "There are **3** \"r\"s in the word strawberry."
assert result[1]["type"] == "text"
assert result[1]["text"] == "There are **3** \"r\"s in the word strawberry."
def test_translate_streaming_openai_chunk_to_anthropic_reasoning_content_without_thinking_blocks():