Skip to content

Commit 3a0de37

Browse files
committed
Fix test_anthropic_empty_content_filtering for new _map_message signature
1 parent 7e02ac4 commit 3a0de37

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

tests/models/test_anthropic.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4952,14 +4952,14 @@ async def test_anthropic_empty_content_filtering(env: TestEnv):
49524952
messages_empty_string: list[ModelMessage] = [
49534953
ModelRequest(parts=[UserPromptPart(content='')], kind='request'),
49544954
]
4955-
_, anthropic_messages = await model._map_message(messages_empty_string, ModelRequestParameters()) # type: ignore[attr-defined]
4955+
_, anthropic_messages = await model._map_message(messages_empty_string, ModelRequestParameters(), {}) # type: ignore[attr-defined]
49564956
assert anthropic_messages == snapshot([]) # Empty content should be filtered out
49574957

49584958
# Test _map_message with list containing empty strings in user prompt
49594959
messages_mixed_content: list[ModelMessage] = [
49604960
ModelRequest(parts=[UserPromptPart(content=['', 'Hello', '', 'World'])], kind='request'),
49614961
]
4962-
_, anthropic_messages = await model._map_message(messages_mixed_content, ModelRequestParameters()) # type: ignore[attr-defined]
4962+
_, anthropic_messages = await model._map_message(messages_mixed_content, ModelRequestParameters(), {}) # type: ignore[attr-defined]
49634963
assert anthropic_messages == snapshot(
49644964
[{'role': 'user', 'content': [{'text': 'Hello', 'type': 'text'}, {'text': 'World', 'type': 'text'}]}]
49654965
)
@@ -4970,15 +4970,15 @@ async def test_anthropic_empty_content_filtering(env: TestEnv):
49704970
ModelResponse(parts=[TextPart(content='')], kind='response'), # Empty response
49714971
ModelRequest(parts=[UserPromptPart(content='Hello')], kind='request'),
49724972
]
4973-
_, anthropic_messages = await model._map_message(messages, ModelRequestParameters()) # type: ignore[attr-defined]
4973+
_, anthropic_messages = await model._map_message(messages, ModelRequestParameters(), {}) # type: ignore[attr-defined]
49744974
# The empty assistant message should be filtered out
49754975
assert anthropic_messages == snapshot([{'role': 'user', 'content': [{'text': 'Hello', 'type': 'text'}]}])
49764976

49774977
# Test with only empty assistant parts
49784978
messages_resp: list[ModelMessage] = [
49794979
ModelResponse(parts=[TextPart(content=''), TextPart(content='')], kind='response'),
49804980
]
4981-
_, anthropic_messages = await model._map_message(messages_resp, ModelRequestParameters()) # type: ignore[attr-defined]
4981+
_, anthropic_messages = await model._map_message(messages_resp, ModelRequestParameters(), {}) # type: ignore[attr-defined]
49824982
assert len(anthropic_messages) == 0 # No messages should be added
49834983

49844984

0 commit comments

Comments
 (0)