From 37e1bfecb119a97f6156a4c2b762a6f3993d2472 Mon Sep 17 00:00:00 2001 From: Tin Chi Lo Date: Fri, 28 Aug 2026 11:23:45 -0700 Subject: [PATCH] test(router): cover _declared_param_allowlist malformed declarations --- tests/test_litellm/test_router.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/test_litellm/test_router.py b/tests/test_litellm/test_router.py index 287dddb2399..3f238d225a8 100644 --- a/tests/test_litellm/test_router.py +++ b/tests/test_litellm/test_router.py @@ -11299,6 +11299,15 @@ class TestTierParamsTheTargetAccepts: assert accepted == {"allowed_openai_params": ["seed"]} + def test_declared_param_allowlist_ignores_malformed_declarations(self): + """A str is iterable, so without the type guard a YAML scalar mistake like + allowed_openai_params: reasoning_effort would allowlist single characters.""" + assert litellm.Router._declared_param_allowlist({"allowed_openai_params": ["reasoning_effort", 3]}) == frozenset( + {"reasoning_effort"} + ) + assert litellm.Router._declared_param_allowlist({"allowed_openai_params": "reasoning_effort"}) == frozenset() + assert litellm.Router._declared_param_allowlist({}) == frozenset() + def test_deployment_accepts_param_honors_deployment_allowlist(self): deployment = { "model_name": "x",