From e7c2ce8624134ba00cbfc1cfa85b05ca0ec4c895 Mon Sep 17 00:00:00 2001 From: Marty Sullivan Date: Sun, 16 Aug 2026 23:21:24 -0400 Subject: [PATCH] test(batches): cover the deployment with no resolvable model at all Codecov's remaining uncovered patch line was the early return taken when no model is available to look a published entry up by, which leaves a deployment's own declared rates standing alone. Measuring the patch lines against the coverage report now leaves none uncovered. --- .../test_litellm_logging.py | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/test_litellm/litellm_core_utils/test_litellm_logging.py b/tests/test_litellm/litellm_core_utils/test_litellm_logging.py index 8e1d4cb877f..180889fc36f 100644 --- a/tests/test_litellm/litellm_core_utils/test_litellm_logging.py +++ b/tests/test_litellm/litellm_core_utils/test_litellm_logging.py @@ -437,6 +437,28 @@ class TestGetRouterDeploymentModelInfo: finally: litellm.model_cost.pop(deployment_id, None) + def test_keeps_declared_rates_when_no_model_is_resolvable(self, logging_obj) -> None: + """With no model to look a published entry up by, the declared rates stand alone.""" + deployment_id = "deploy-no-model-at-all-1" + litellm.model_cost[deployment_id] = { + "id": deployment_id, + "input_cost_per_token": 9e-06, + "output_cost_per_token": 2e-05, + "litellm_provider": "bedrock", + "mode": "chat", + } + logging_obj.litellm_params = {"litellm_metadata": {"model_info": {"id": deployment_id}}} + logging_obj.model_call_details["model"] = None + logging_obj.model = None + try: + assert logging_obj.get_deployment_model_for_cost() is None + info = logging_obj.get_router_deployment_model_info() + assert info is not None + assert info["input_cost_per_token"] == 9e-06 + assert info["output_cost_per_token"] == 2e-05 + finally: + litellm.model_cost.pop(deployment_id, None) + def test_returns_none_when_the_deployment_id_resolves_no_provider(self, logging_obj) -> None: """A registration whose id get_model_info cannot resolve yields no pricing.""" deployment_id = "deploy-unresolvable-provider-1"