Skip to content

Commit b1f6d6c

Browse files
committed
Fix test_anthropic_empty_content_filtering for new _map_message signature
1 parent e82901a commit b1f6d6c

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
@@ -4887,14 +4887,14 @@ async def test_anthropic_empty_content_filtering(env: TestEnv):
48874887
messages_empty_string: list[ModelMessage] = [
48884888
ModelRequest(parts=[UserPromptPart(content='')], kind='request'),
48894889
]
4890-
_, anthropic_messages = await model._map_message(messages_empty_string, ModelRequestParameters()) # type: ignore[attr-defined]
4890+
_, anthropic_messages = await model._map_message(messages_empty_string, ModelRequestParameters(), {}) # type: ignore[attr-defined]
48914891
assert anthropic_messages == snapshot([]) # Empty content should be filtered out
48924892

48934893
# Test _map_message with list containing empty strings in user prompt
48944894
messages_mixed_content: list[ModelMessage] = [
48954895
ModelRequest(parts=[UserPromptPart(content=['', 'Hello', '', 'World'])], kind='request'),
48964896
]
4897-
_, anthropic_messages = await model._map_message(messages_mixed_content, ModelRequestParameters()) # type: ignore[attr-defined]
4897+
_, anthropic_messages = await model._map_message(messages_mixed_content, ModelRequestParameters(), {}) # type: ignore[attr-defined]
48984898
assert anthropic_messages == snapshot(
48994899
[{'role': 'user', 'content': [{'text': 'Hello', 'type': 'text'}, {'text': 'World', 'type': 'text'}]}]
49004900
)
@@ -4905,15 +4905,15 @@ async def test_anthropic_empty_content_filtering(env: TestEnv):
49054905
ModelResponse(parts=[TextPart(content='')], kind='response'), # Empty response
49064906
ModelRequest(parts=[UserPromptPart(content='Hello')], kind='request'),
49074907
]
4908-
_, anthropic_messages = await model._map_message(messages, ModelRequestParameters()) # type: ignore[attr-defined]
4908+
_, anthropic_messages = await model._map_message(messages, ModelRequestParameters(), {}) # type: ignore[attr-defined]
49094909
# The empty assistant message should be filtered out
49104910
assert anthropic_messages == snapshot([{'role': 'user', 'content': [{'text': 'Hello', 'type': 'text'}]}])
49114911

49124912
# Test with only empty assistant parts
49134913
messages_resp: list[ModelMessage] = [
49144914
ModelResponse(parts=[TextPart(content=''), TextPart(content='')], kind='response'),
49154915
]
4916-
_, anthropic_messages = await model._map_message(messages_resp, ModelRequestParameters()) # type: ignore[attr-defined]
4916+
_, anthropic_messages = await model._map_message(messages_resp, ModelRequestParameters(), {}) # type: ignore[attr-defined]
49174917
assert len(anthropic_messages) == 0 # No messages should be added
49184918

49194919

0 commit comments

Comments
 (0)