From e50b88f74335c6f6dd5c1de006233d82e01cfd27 Mon Sep 17 00:00:00 2001 From: TobiMayr Date: Tue, 27 Oct 2026 12:30:51 +0000 Subject: [PATCH] test(router): cover the rpm helper's malformed-deployment guards Codecov was failing the patch check on the two early returns that ignore a deployment which cannot carry rpm. Co-authored-by: Cursor --- tests/unit/test_router/test_router.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/unit/test_router/test_router.py b/tests/unit/test_router/test_router.py index 40d60214b4c..7d6651b93f1 100644 --- a/tests/unit/test_router/test_router.py +++ b/tests/unit/test_router/test_router.py @@ -24791,6 +24791,24 @@ def test_no_rpm_cache_read_when_no_deployment_has_rpm(): assert get_cache_calls == [], f"Expected zero cache reads, got {get_cache_calls}" +def test_rpm_helper_ignores_deployments_that_cannot_carry_rpm(): + router = Router( + model_list=[ + { + "model_name": "test", + "litellm_params": {"model": "gpt-5-mini", "api_key": "sk-test"}, + "model_info": {"id": "plain"}, + }, + ], + set_verbose=False, + enable_pre_call_checks=True, + ) + + assert router._deployment_configures_rpm(["not", "a", "deployment"]) is False + assert router._deployment_configures_rpm({"litellm_params": None}) is False + assert router._deployment_configures_rpm({"litellm_params": {"rpm": 5}}) is True + + def test_rpm_cache_still_read_and_enforced_when_a_deployment_has_rpm(): router = Router( model_list=[