From 3894455c9969e893c176a6dd8273a40144755f03 Mon Sep 17 00:00:00 2001 From: mateo-berri <277851410+mateo-berri@users.noreply.github.com> Date: Tue, 18 Aug 2026 15:20:13 -0700 Subject: [PATCH] test(caching): annotate new semantic cache and hosted_vllm test helpers --- tests/test_litellm/caching/test_redis_semantic_cache.py | 7 ++++--- .../embedding/test_hosted_vllm_embedding_transformation.py | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/test_litellm/caching/test_redis_semantic_cache.py b/tests/test_litellm/caching/test_redis_semantic_cache.py index ad0ea6b7774..9fd333cf87c 100644 --- a/tests/test_litellm/caching/test_redis_semantic_cache.py +++ b/tests/test_litellm/caching/test_redis_semantic_cache.py @@ -1167,7 +1167,7 @@ async def test_redis_async_embedding_forwards_full_metadata(monkeypatch): LONG_PROMPT = " ".join(f"token{i}" for i in range(300)) -def _proxy_with_router(monkeypatch, router, model_name): +def _proxy_with_router(monkeypatch: pytest.MonkeyPatch, router: MagicMock, model_name: str) -> None: import sys import types @@ -1177,7 +1177,7 @@ def _proxy_with_router(monkeypatch, router, model_name): monkeypatch.setitem(sys.modules, "litellm.proxy.proxy_server", fake_proxy) -def _token_count(model, text): +def _token_count(model: str, text: str) -> int: import litellm return len(litellm.encode(model=model, text=text)) @@ -1254,7 +1254,8 @@ def test_redis_semantic_cache_init_stores_embedding_max_input_tokens(monkeypatch embedding_max_input_tokens=512, ) assert cache.embedding_max_input_tokens == 512 - assert RedisSemanticCache(redis_url="redis://localhost:6379", similarity_threshold=0.8).embedding_max_input_tokens is None + default_cache = RedisSemanticCache(redis_url="redis://localhost:6379", similarity_threshold=0.8) + assert default_cache.embedding_max_input_tokens is None def test_redis_init_defers_redisvl_construction(monkeypatch): diff --git a/tests/test_litellm/llms/hosted_vllm/embedding/test_hosted_vllm_embedding_transformation.py b/tests/test_litellm/llms/hosted_vllm/embedding/test_hosted_vllm_embedding_transformation.py index 29d58b35b84..93c518599d6 100644 --- a/tests/test_litellm/llms/hosted_vllm/embedding/test_hosted_vllm_embedding_transformation.py +++ b/tests/test_litellm/llms/hosted_vllm/embedding/test_hosted_vllm_embedding_transformation.py @@ -296,7 +296,7 @@ class TestHostedVLLMEmbeddingTransformation: {"truncate": "END", "input_type": "query"}, ], ) - def test_provider_params_are_sent_at_the_top_level_of_the_request(self, provider_params): + def test_provider_params_are_sent_at_the_top_level_of_the_request(self, provider_params: dict[str, object]) -> None: from litellm.llms.custom_httpx.http_handler import HTTPHandler client = HTTPHandler()