test(anthropic): mark the new test variables Final

This commit is contained in:
mateo-berri 2026-10-28 18:16:02 -07:00
parent 546b8fd6d9
commit 48d2cd1c56
2 changed files with 5 additions and 6 deletions

View file

@ -65,13 +65,13 @@ class TestCreateErrorResponse:
@pytest.mark.parametrize("status_code", [402, 405, 409, 418, 422, 504])
def test_a_status_outside_the_table_stays_an_api_error_for_the_sdk_and_stream_frames(self, status_code: int):
response = AnthropicExceptionMapping.create_error_response(status_code, "scripted status")
frame = anthropic_error_sse_frame(status_code=status_code, raw_message="scripted status")
response: Final = AnthropicExceptionMapping.create_error_response(status_code, "scripted status")
frame: Final = anthropic_error_sse_frame(status_code=status_code, raw_message="scripted status")
assert response["error"]["type"] == "api_error"
assert frame.error_response["error"]["type"] == "api_error"
def test_an_explicit_error_type_wins_over_the_status_table(self):
response = AnthropicExceptionMapping.create_error_response(402, "Budget exceeded", error_type="billing_error")
response: Final = AnthropicExceptionMapping.create_error_response(402, "Budget exceeded", error_type="billing_error")
assert response["error"]["type"] == "billing_error"

View file

@ -208,10 +208,9 @@ class TestProxyExceptionAnthropicEnvelope:
import litellm.proxy.anthropic_endpoints.endpoints as ep
from litellm.proxy._types import ProxyException
request = MagicMock()
request.headers = {}
request: Final = MagicMock(headers={})
response = ep._anthropic_error_json_response(
response: Final = ep._anthropic_error_json_response(
ProxyException(message="scripted", type="budget_exceeded", param=None, code=status_code), request
)