From 5d7dee710b5c3956697be1a8edf0489504edc79d Mon Sep 17 00:00:00 2001 From: Ousama Ben Younes Date: Sat, 15 Aug 2026 08:07:20 +0000 Subject: [PATCH] test(vertex_ai): actually annotate web-search regression vars as Final Address the Greptile review on #36397. The earlier commit only ratcheted the LIT010 budget; it never applied the annotations, so duplicates_in_one_item and duplicates_across_items were still bound without a Final declaration (LIT010) and the first fixture line was at the 120-char ceiling. Annotate both with `: Final` and wrap the long literal. RED -> GREEN: check_type_discipline flagged both vars LIT010 before -> LIT010 gone after (file total 551 -> 549, LIT002 unchanged at 953); test_calculate_web_search_requests_counts_unique_queries still passes. --- .../gemini/test_vertex_and_google_ai_studio_gemini.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/test_litellm/llms/vertex_ai/gemini/test_vertex_and_google_ai_studio_gemini.py b/tests/test_litellm/llms/vertex_ai/gemini/test_vertex_and_google_ai_studio_gemini.py index d14fb6021ed..3a04424a581 100644 --- a/tests/test_litellm/llms/vertex_ai/gemini/test_vertex_and_google_ai_studio_gemini.py +++ b/tests/test_litellm/llms/vertex_ai/gemini/test_vertex_and_google_ai_studio_gemini.py @@ -2,7 +2,7 @@ import asyncio import json import re from copy import deepcopy -from typing import List, cast +from typing import Final, List, cast from unittest.mock import MagicMock, patch import pytest @@ -5562,10 +5562,12 @@ def test_calculate_web_search_requests_counts_unique_queries(): metadata items must collapse to the distinct-query count, and empty strings must be ignored, matching Google's documented Grounding-with-Search billing rule. """ - duplicates_in_one_item = [{"webSearchQueries": ["euro 2024 winner", "euro 2024 winner", "spain england final", ""]}] + duplicates_in_one_item: Final = [ + {"webSearchQueries": ["euro 2024 winner", "euro 2024 winner", "spain england final", ""]} + ] assert VertexGeminiConfig._calculate_web_search_requests(duplicates_in_one_item) == 2 - duplicates_across_items = [ + duplicates_across_items: Final = [ {"webSearchQueries": ["euro 2024 winner"]}, {"webSearchQueries": ["euro 2024 winner", "spain england final"]}, ]