diff --git a/tests/test_litellm/litellm_core_utils/test_error_normalization.py b/tests/test_litellm/litellm_core_utils/test_error_normalization.py index 750a4fff29a..b7c724584ac 100644 --- a/tests/test_litellm/litellm_core_utils/test_error_normalization.py +++ b/tests/test_litellm/litellm_core_utils/test_error_normalization.py @@ -166,25 +166,21 @@ def test_variants_of_one_failure_share_a_normalized_error(messages: tuple[Except def test_normalize_error_passthrough_prefix_wins_over_upstream_body_text() -> None: - from fastapi import HTTPException - for detail in ( 'Upstream passthrough request failed with status 400: {"error": {"message": "no deployments available for this model"}}', 'Upstream passthrough request failed with status 400: {"error": {"message": "max budget reached"}}', ): - exc = HTTPException(status_code=400, detail=detail) + exc = Exception(detail) message = f"400: {detail}" assert normalize_error(exc, "400", message) == "500_UPSTREAM_PASSTHROUGH", message def test_normalize_error_passthrough_prefix_wins_over_quota_and_budget_wording() -> None: - from fastapi import HTTPException - detail = ( 'Upstream passthrough request failed with status 429: {"error": {"message": ' '"You exceeded your current quota, please check your plan and billing details. Budget spent"}}' ) - exc = HTTPException(status_code=429, detail=detail) + exc = Exception(detail) assert normalize_error(exc, "429", f"429: {detail}") == "500_UPSTREAM_PASSTHROUGH"