From 16b62818b4a72880137ccafdd822fbfd72f3d40b Mon Sep 17 00:00:00 2001 From: dajiaohuang Date: Fri, 4 Sep 2026 14:45:44 +0800 Subject: [PATCH] test: cover InfinityError header defaults --- tests/llm_translation/test_infinity.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/llm_translation/test_infinity.py b/tests/llm_translation/test_infinity.py index 1829113e045..45bb3fb4c3d 100644 --- a/tests/llm_translation/test_infinity.py +++ b/tests/llm_translation/test_infinity.py @@ -15,6 +15,24 @@ from test_rerank import assert_response_shape from base_embedding_unit_tests import BaseLLMEmbeddingTest from litellm.llms.custom_httpx.http_handler import HTTPHandler, AsyncHTTPHandler from litellm.types.utils import EmbeddingResponse, Usage +from litellm.llms.infinity.common_utils import InfinityError + + +def test_infinity_error_uses_fresh_headers_when_omitted(): + first = InfinityError(status_code=400, message="first") + second = InfinityError(status_code=400, message="second") + + assert first.headers == {} + assert second.headers == {} + assert first.headers is not second.headers + + +def test_infinity_error_preserves_supplied_headers(): + headers = {"x-request-id": "request-1"} + + error = InfinityError(status_code=400, message="failed", headers=headers) + + assert error.headers is headers @pytest.mark.asyncio()