test: annotate the remaining new test locals with Final
Some checks failed
LiteLLM Rust / rust-wheel (push) Has been cancelled
LiteLLM Rust / rust-lint (push) Has been cancelled
LiteLLM Rust / rust-test (push) Has been cancelled

This commit is contained in:
mateo-berri 2026-10-23 19:56:27 -07:00
parent 6eb4d310fd
commit 89236c4bd8
5 changed files with 13 additions and 11 deletions

View file

@ -364,8 +364,8 @@ def test_load_prompts_from_json_data():
def test_load_prompts_from_json_data_skips_malformed_entries():
manager = PromptManager(prompt_directory=str(Path(__file__).parent))
initial_count = len(manager.prompts)
manager: Final = PromptManager(prompt_directory=str(Path(__file__).parent))
initial_count: Final = len(manager.prompts)
manager.load_prompts_from_json_data(
{

View file

@ -2,7 +2,7 @@ import json
import os
import sys
from unittest.mock import AsyncMock, patch
from typing import Optional
from typing import Final, Optional
import httpx
import pytest
@ -287,7 +287,7 @@ def test_compactifai_malformed_response_body_raises_the_error_of_the_failing_loo
from litellm.llms.compactifai.chat.transformation import CompactifAIChatConfig
raw_response = httpx.Response(
raw_response: Final = httpx.Response(
200, json=body, request=httpx.Request("POST", "https://api.compactif.ai/v1/chat/completions")
)

View file

@ -1,3 +1,4 @@
from typing import Final
from unittest.mock import MagicMock
import httpx
@ -19,7 +20,7 @@ def test_output_dict_with_non_string_values_still_yields_the_image(respx_mock):
},
status_code=200,
)
created = httpx.Response(
created: Final = httpx.Response(
200,
json={"id": "task_1", "status": "PENDING"},
request=httpx.Request(
@ -27,7 +28,7 @@ def test_output_dict_with_non_string_values_still_yields_the_image(respx_mock):
),
)
image_response = RunwayMLImageGenerationConfig().transform_image_generation_response(
image_response: Final = RunwayMLImageGenerationConfig().transform_image_generation_response(
model="gen4_image",
raw_response=created,
model_response=ImageResponse(),
@ -42,7 +43,7 @@ def test_output_dict_with_non_string_values_still_yields_the_image(respx_mock):
def test_non_object_task_body_raises_the_base_error_class():
created = httpx.Response(
created: Final = httpx.Response(
200,
json=["unexpected"],
request=httpx.Request(
@ -65,7 +66,7 @@ def test_non_object_task_body_raises_the_base_error_class():
@pytest.mark.asyncio
async def test_async_non_object_task_body_raises_the_base_error_class():
created = httpx.Response(
created: Final = httpx.Response(
200,
json=["unexpected"],
request=httpx.Request(

View file

@ -6,6 +6,7 @@ external callers only see servers with available_on_public_internet=True.
"""
import logging
from typing import Final
from unittest.mock import MagicMock, patch
import pytest
@ -177,9 +178,9 @@ class TestMCPClientIPExtraction:
assert result == "203.0.113.5"
def test_non_boolean_use_x_forwarded_for_never_trusts_xff(self):
request = _make_request("10.0.0.5", "203.0.113.9, 10.0.0.5")
request: Final = _make_request("10.0.0.5", "203.0.113.9, 10.0.0.5")
result = IPAddressUtils.get_mcp_client_ip(
result: Final = IPAddressUtils.get_mcp_client_ip(
request,
general_settings={
"use_x_forwarded_for": "false",

View file

@ -85,6 +85,6 @@ def test_migrate_prints_no_residual_status_for_a_residual_below_zero_or_nan(runn
@pytest.mark.parametrize("report", [None, "done", {"residual_legacy": "3"}])
def test_migrate_malformed_report_fails(runner, report):
_FakeHTTPClient.response = {"status": "success", "report": report}
result = runner.invoke(cli_main.cli, ["encryption", "migrate", "--check"])
result: Final = runner.invoke(cli_main.cli, ["encryption", "migrate", "--check"])
assert result.exit_code != 0
assert "Unexpected" in result.output