mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-12 23:01:41 +00:00
test(router): cover _underlying_model_for_group alias resolution
The router code-coverage gate requires every router.py function to be exercised by a test file whose name contains "router". Add a focused test that builds a Router with an aliased deployment and asserts the group name resolves to the deployment's registry model, with None for unknown groups.
This commit is contained in:
parent
cb8f903bb9
commit
a7d4f7f131
1 changed files with 24 additions and 0 deletions
|
|
@ -4756,3 +4756,27 @@ def test_is_deployment_blocked_static_helper_reflects_blocked_flag():
|
|||
)
|
||||
is True
|
||||
)
|
||||
|
||||
|
||||
def test_underlying_model_for_group_resolves_alias():
|
||||
"""The mid-stream prefill check resolves a custom router group name to the
|
||||
deployment's registry model, so an alias like "production-claude" surfaces
|
||||
"anthropic/claude-sonnet-4-6" (which the registry keys on) instead of the
|
||||
unregistered alias. Unknown groups return None."""
|
||||
router = litellm.Router(
|
||||
model_list=[
|
||||
{
|
||||
"model_name": "production-claude",
|
||||
"litellm_params": {
|
||||
"model": "anthropic/claude-sonnet-4-6",
|
||||
"api_key": "sk-fake",
|
||||
},
|
||||
}
|
||||
],
|
||||
)
|
||||
|
||||
assert (
|
||||
router._underlying_model_for_group("production-claude")
|
||||
== "anthropic/claude-sonnet-4-6"
|
||||
)
|
||||
assert router._underlying_model_for_group("nonexistent-group") is None
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue