test(router): cover _declared_param_allowlist malformed declarations

This commit is contained in:
Tin Chi Lo 2026-08-28 11:23:45 -07:00
parent 5338f293aa
commit 37e1bfecb1

View file

@ -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",