From 39de3bcbab66aa4820265df2de4fd18e3d84bcde Mon Sep 17 00:00:00 2001 From: mateo Date: Sat, 31 Oct 2026 23:06:59 +0000 Subject: [PATCH] test(responses): shard the bridge check tests and mark their locals Final Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- .github/workflows/test-unit.yml | 1 + ...ellm_responses_transformation_transformation.py | 10 ++++++---- tests/unit/responses/test_bridge_check.py | 14 ++++++++------ 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/.github/workflows/test-unit.yml b/.github/workflows/test-unit.yml index 2c05ee827a3..ca779997360 100644 --- a/.github/workflows/test-unit.yml +++ b/.github/workflows/test-unit.yml @@ -735,6 +735,7 @@ jobs: tests/unit/responses/test_no_duplicate_spend_logs.py tests/unit/responses/test_null_test_fix.py tests/unit/responses/test_responses_api_bridge_flag.py + tests/unit/responses/test_bridge_check.py tests/unit/responses/test_responses_api_lifecycle.py tests/unit/responses/test_responses_api_request_body.py tests/unit/responses/test_responses_prompt_management.py diff --git a/tests/unit/completion_extras/test_litellm_responses_transformation_transformation.py b/tests/unit/completion_extras/test_litellm_responses_transformation_transformation.py index e83aa7e0b17..cd423abe042 100644 --- a/tests/unit/completion_extras/test_litellm_responses_transformation_transformation.py +++ b/tests/unit/completion_extras/test_litellm_responses_transformation_transformation.py @@ -2,6 +2,8 @@ Test for response_format to text.format conversion in completion -> responses bridge """ +from typing import Final + import pytest from litellm.completion_extras.litellm_responses_transformation.transformation import ( LiteLLMResponsesTransformationHandler, @@ -267,9 +269,9 @@ class _LoggingObj: def test_transform_request_flattens_chat_web_search_user_location_for_the_responses_tool(): """Chat Completions nests the location under `approximate`; OpenAI's Responses web_search tool rejects that key ("Unknown parameter: 'tools[0].user_location.approximate'") and takes the fields flat.""" - handler = LiteLLMResponsesTransformationHandler() + handler: Final = LiteLLMResponsesTransformationHandler() - result = handler.transform_request( + result: Final = handler.transform_request( model="gpt-5.6-sol", messages=[{"role": "user", "content": "What is a top local headline today?"}], optional_params={ @@ -293,9 +295,9 @@ def test_transform_request_flattens_chat_web_search_user_location_for_the_respon def test_transform_request_keeps_a_web_search_option_without_a_location_as_sent(): - handler = LiteLLMResponsesTransformationHandler() + handler: Final = LiteLLMResponsesTransformationHandler() - result = handler.transform_request( + result: Final = handler.transform_request( model="gpt-5.6-sol", messages=[{"role": "user", "content": "What is the top headline today?"}], optional_params={"web_search_options": {"search_context_size": "low"}}, diff --git a/tests/unit/responses/test_bridge_check.py b/tests/unit/responses/test_bridge_check.py index a0b09024aad..d7cee7a16ba 100644 --- a/tests/unit/responses/test_bridge_check.py +++ b/tests/unit/responses/test_bridge_check.py @@ -1,35 +1,37 @@ +from typing import Final + from litellm.responses.bridge_check import bridge_check_request_params def test_a_dropped_effort_inside_extra_body_is_not_read_by_the_route_decision(): - request = { + request: Final = { "extra_body": {"reasoning_effort": "low", "reasoningSummary": "auto"}, "additional_drop_params": ["reasoning_effort"], "tools": [{"type": "function", "function": {"name": "get_weather"}}], } - params = bridge_check_request_params(request) + params: Final = bridge_check_request_params(request) assert params["extra_body"] == {"reasoningSummary": "auto"}, params assert params["tools"] is request["tools"] def test_a_dropped_top_level_alias_is_removed_too(): - params = bridge_check_request_params({"reasoningSummary": "auto", "additional_drop_params": ["reasoningSummary"]}) + params: Final = bridge_check_request_params({"reasoningSummary": "auto", "additional_drop_params": ["reasoningSummary"]}) assert "reasoningSummary" not in params, params def test_a_request_without_drops_is_returned_whole(): - request = {"extra_body": {"reasoning_effort": "low"}, "tools": []} + request: Final = {"extra_body": {"reasoning_effort": "low"}, "tools": []} - params = bridge_check_request_params(request) + params: Final = bridge_check_request_params(request) assert params == request assert params["extra_body"] == {"reasoning_effort": "low"} def test_a_non_list_additional_drop_params_drops_nothing(): - request = {"extra_body": {"reasoning_effort": "low"}, "additional_drop_params": "reasoning_effort"} + request: Final = {"extra_body": {"reasoning_effort": "low"}, "additional_drop_params": "reasoning_effort"} assert bridge_check_request_params(request)["extra_body"] == {"reasoning_effort": "low"}