Skip to content

Commit 661bccb

Browse files
fixed flaky test by sorting list
1 parent e420b63 commit 661bccb

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

tests/test_litellm/llms/bedrock/test_anthropic_beta_support.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ def test_converse_transformation_anthropic_beta(self):
8080
assert "additionalModelRequestFields" in result
8181
additional_fields = result["additionalModelRequestFields"]
8282
assert "anthropic_beta" in additional_fields
83-
assert additional_fields["anthropic_beta"] == ["context-1m-2025-08-07", "interleaved-thinking-2025-05-14"]
83+
# Sort both arrays before comparing to avoid flakiness from ordering differences
84+
assert sorted(additional_fields["anthropic_beta"]) == sorted(["context-1m-2025-08-07", "interleaved-thinking-2025-05-14"])
8485

8586
def test_messages_transformation_anthropic_beta(self):
8687
"""Test that Messages API transformation includes anthropic_beta in request."""
@@ -96,7 +97,8 @@ def test_messages_transformation_anthropic_beta(self):
9697
)
9798

9899
assert "anthropic_beta" in result
99-
assert result["anthropic_beta"] == ["output-128k-2025-02-19"]
100+
# Sort both arrays before comparing to avoid flakiness from ordering differences
101+
assert sorted(result["anthropic_beta"]) == sorted(["output-128k-2025-02-19"])
100102

101103
def test_converse_computer_use_compatibility(self):
102104
"""Test that user anthropic_beta headers work with computer use tools."""
@@ -287,4 +289,4 @@ def test_prompt_caching_with_other_beta_headers(self):
287289
assert "prompt-caching-2024-07-31" not in result["anthropic_beta"]
288290
else:
289291
# If no beta headers, that's also fine
290-
assert True
292+
assert True

0 commit comments

Comments
 (0)