We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Self
TestClient.__enter__
1 parent 739ea49 commit e741635Copy full SHA for e741635
starlette/testclient.py
@@ -35,6 +35,11 @@
35
else: # pragma: no cover
36
from typing_extensions import TypeGuard
37
38
+if sys.version_info >= (3, 11): # pragma: no cover
39
+ from typing import Self
40
+else: # pragma: no cover
41
+ from typing_extensions import Self
42
+
43
try:
44
import httpx
45
except ModuleNotFoundError: # pragma: no cover
@@ -667,7 +672,7 @@ def websocket_connect(
667
672
668
673
return session
669
674
670
- def __enter__(self) -> TestClient:
675
+ def __enter__(self) -> Self:
671
676
with contextlib.ExitStack() as stack:
677
self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend))
678
0 commit comments