Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

fixed flaky test by sorting list

Colin Lin661bccbc3984
diff --git a/tests/test_litellm/llms/bedrock/test_anthropic_beta_support.py b/tests/test_litellm/llms/bedrock/test_anthropic_beta_support.py
index bd64670517c..7de2294954c 100644
--- a/tests/test_litellm/llms/bedrock/test_anthropic_beta_support.py
+++ b/tests/test_litellm/llms/bedrock/test_anthropic_beta_support.py
@@ -80,7 +80,8 @@ class TestAnthropicBetaHeaderSupport:
assert "additionalModelRequestFields" in result
additional_fields = result["additionalModelRequestFields"]
assert "anthropic_beta" in additional_fields
- assert additional_fields["anthropic_beta"] == ["context-1m-2025-08-07", "interleaved-thinking-2025-05-14"]
+ # Sort both arrays before comparing to avoid flakiness from ordering differences
+ assert sorted(additional_fields["anthropic_beta"]) == sorted(["context-1m-2025-08-07", "interleaved-thinking-2025-05-14"])
def test_messages_transformation_anthropic_beta(self):
"""Test that Messages API transformation includes anthropic_beta in request."""
@@ -96,7 +97,8 @@ class TestAnthropicBetaHeaderSupport:
)
assert "anthropic_beta" in result
- assert result["anthropic_beta"] == ["output-128k-2025-02-19"]
+ # Sort both arrays before comparing to avoid flakiness from ordering differences
+ assert sorted(result["anthropic_beta"]) == sorted(["output-128k-2025-02-19"])
def test_converse_computer_use_compatibility(self):
"""Test that user anthropic_beta headers work with computer use tools."""
@@ -287,4 +289,4 @@ class TestAnthropicBetaHeaderSupport:
assert "prompt-caching-2024-07-31" not in result["anthropic_beta"]
else:
# If no beta headers, that's also fine
- assert True
\ No newline at end of file
+ assert True