Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

test(realtime): fully type the capturing websocket connect double

mateo-berri3c9690c4f57c
diff --git a/tests/test_litellm/realtime_api/test_main.py b/tests/test_litellm/realtime_api/test_main.py
index 4f50bbbd8c5..4b0bae1458e 100644
--- a/tests/test_litellm/realtime_api/test_main.py
+++ b/tests/test_litellm/realtime_api/test_main.py
@@ -1,5 +1,6 @@
import asyncio
import time
+from types import TracebackType
from unittest.mock import MagicMock, patch
@@ -194,19 +195,22 @@ def test_client_secret_forwards_nested_transcription_model_untouched(monkeypatch
class _CapturingConnect:
- def __init__(self):
- self.url = None
- self.additional_headers = None
+ def __init__(self) -> None:
+ self.url: str | None = None
- def __call__(self, url, **kwargs):
+ def __call__(self, url: str, **kwargs: object) -> "_CapturingConnect":
self.url = url
- self.additional_headers = kwargs.get("additional_headers")
return self
- async def __aenter__(self):
+ async def __aenter__(self) -> MagicMock:
return MagicMock()
- async def __aexit__(self, exc_type, exc, tb):
+ async def __aexit__(
+ self,
+ exc_type: type[BaseException] | None,
+ exc: BaseException | None,
+ tb: TracebackType | None,
+ ) -> None:
return None