From dc09609e55f75077a3639284ea38adc4c4443c00 Mon Sep 17 00:00:00 2001 From: shrey kharbanda Date: Thu, 24 Sep 2026 01:05:59 +0000 Subject: [PATCH] fix(azure_ai): raise TypeError for wrong response type and dedupe test basename --- litellm/llms/azure_ai/image_generation/cost_calculator.py | 2 +- ...tor.py => test_azure_ai_image_generation_cost_calculator.py} | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename tests/test_litellm/llms/azure_ai/image_generation/{test_cost_calculator.py => test_azure_ai_image_generation_cost_calculator.py} (98%) diff --git a/litellm/llms/azure_ai/image_generation/cost_calculator.py b/litellm/llms/azure_ai/image_generation/cost_calculator.py index 10c75c9665b..274eb9facc4 100644 --- a/litellm/llms/azure_ai/image_generation/cost_calculator.py +++ b/litellm/llms/azure_ai/image_generation/cost_calculator.py @@ -38,7 +38,7 @@ def cost_calculator( Azure AI image generation cost calculator """ if not isinstance(image_response, ImageResponse): - raise ValueError(f"image_response must be of type ImageResponse got type={type(image_response)}") + raise TypeError(f"image_response must be of type ImageResponse got type={type(image_response)}") resolved: Final = resolve_image_model_info( model=model, diff --git a/tests/test_litellm/llms/azure_ai/image_generation/test_cost_calculator.py b/tests/test_litellm/llms/azure_ai/image_generation/test_azure_ai_image_generation_cost_calculator.py similarity index 98% rename from tests/test_litellm/llms/azure_ai/image_generation/test_cost_calculator.py rename to tests/test_litellm/llms/azure_ai/image_generation/test_azure_ai_image_generation_cost_calculator.py index 4f5278fc750..ce6d0001659 100644 --- a/tests/test_litellm/llms/azure_ai/image_generation/test_cost_calculator.py +++ b/tests/test_litellm/llms/azure_ai/image_generation/test_azure_ai_image_generation_cost_calculator.py @@ -161,5 +161,5 @@ def test_unlisted_model_bills_deployment_rates() -> None: def test_non_image_response_raises() -> None: - with pytest.raises(ValueError, match="must be of type ImageResponse"): + with pytest.raises(TypeError, match="must be of type ImageResponse"): cost_calculator(model="FLUX.2-flex", image_response=object())