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]

test(router): cover the retry skip-list narrowing helper

mateo-berri0fcf0fe06c80
diff --git a/tests/test_litellm/test_router.py b/tests/test_litellm/test_router.py
index 696abcd65a5..05ac672691e 100644
--- a/tests/test_litellm/test_router.py
+++ b/tests/test_litellm/test_router.py
@@ -13277,6 +13277,26 @@ def test_router_deployment_ids_to_skip_on_retry(status_code, failed_deployment_i
assert litellm.Router._deployment_ids_to_skip_on_retry(exception, already_skipped) == expected
+ "value,expected",
+ [
+ (("first", "second"), ("first", "second")),
+ ((), ()),
+ (("first", 7, None, "second"), ("first", "second")),
+ (None, ()),
+ (7, ()),
+ ("first", ()),
+ (["first"], ()),
+ ({"first": True}, ()),
+ (object(), ()),
+ ],
+)
+def test_router_as_retry_skipped_deployment_ids_keeps_only_a_tuple_of_strings(value, expected):
+ from litellm.router import _as_retry_skipped_deployment_ids
+
+ assert _as_retry_skipped_deployment_ids(value) == expected
+
+
@pytest.mark.parametrize(
"deployment_ids,skipped,expected",
[