mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-10 22:41:41 +00:00
test: ensure model_names is a O(1) datastructure
This commit is contained in:
parent
3b14866d78
commit
e154ab6a66
1 changed files with 8 additions and 0 deletions
|
|
@ -179,6 +179,14 @@ class TestRouterIndexManagement:
|
|||
assert "claude-3" in router.model_name_to_deployment_indices
|
||||
assert router.model_name_to_deployment_indices["claude-3"] == [0]
|
||||
|
||||
def test_model_names_is_set(self):
|
||||
"""Verify that model_names uses a set for O(1) lookups, not a list (O(n))"""
|
||||
router = Router(model_list=[])
|
||||
|
||||
assert isinstance(router.model_names, set), (
|
||||
f"model_names should be a set for O(1) lookups, but got {type(router.model_names)}"
|
||||
)
|
||||
|
||||
def test_no_linear_scans_in_router(self):
|
||||
"""
|
||||
Static analysis test to ensure Router doesn't use O(n) linear scans.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue