From 2b7a8e77ae65538e089ace13622a4b2755004cf3 Mon Sep 17 00:00:00 2001 From: ajitsharmas2007 Date: Mon, 21 Sep 2026 14:57:24 +0530 Subject: [PATCH] test(pricing): assert the whole default listing entry Review flagged the default-response test for pinning a field's absence. Asserting the entry whole is both what tests/AGENTS.md asks for and a stronger check: it fails for any unexpected key the listing starts emitting, not just for `pricing`. Verified by mutation: adding a stray key to the response fails this test. --- tests/test_litellm/proxy/test_proxy_utils.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/tests/test_litellm/proxy/test_proxy_utils.py b/tests/test_litellm/proxy/test_proxy_utils.py index 9d3421cadc1..97763ccd160 100644 --- a/tests/test_litellm/proxy/test_proxy_utils.py +++ b/tests/test_litellm/proxy/test_proxy_utils.py @@ -987,6 +987,7 @@ class TestPostCallFailureHookEstimatesDispatchedInputTokens: from typing import cast import litellm +from litellm.constants import DEFAULT_MODEL_CREATED_AT_TIME from litellm.proxy.utils import create_model_info_response from litellm.types.router import DeploymentListingPrice, DeploymentModelListingInfo from litellm.types.utils import ModelInfo @@ -1130,7 +1131,11 @@ def test_create_model_info_response_reports_widest_window_in_a_mixed_group(): def test_create_model_info_response_omits_pricing_unless_asked(): - """The default listing shape is unchanged, so existing clients see no new field.""" + """A caller who does not ask for pricing gets the same entry as before the flag. + + Asserted whole rather than as "pricing is absent", so any other key the listing starts + emitting by default fails here too. + """ response = create_model_info_response( model_id="gpt-4o", provider="openai", @@ -1140,7 +1145,12 @@ def test_create_model_info_response_omits_pricing_unless_asked(): ), ) - assert "pricing" not in response + assert response == { + "id": "gpt-4o", + "object": "model", + "created": DEFAULT_MODEL_CREATED_AT_TIME, + "owned_by": "openai", + }, f"the default listing entry changed shape: {response}" def test_create_model_info_response_includes_cost_map_pricing():