Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix type hint of Mocker.__enter__/__exit__ #257

Merged
merged 1 commit into from
Apr 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions requests_mock/mocker.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
from json import JSONEncoder
from http.cookiejar import CookieJar
from io import IOBase
from types import TracebackType
from typing import Any, Callable, Dict, List, Optional, Pattern, Type, TypeVar, Union, overload

from requests import Response, Session
from typing_extensions import Self
from urllib3.response import HTTPResponse

from requests_mock.adapter import AnyMatcher, _Matcher, Callback, AdditionalMatcher
Expand Down Expand Up @@ -255,8 +257,8 @@ class Mocker(MockerCore):
real_http: bool = ...,
json_encoder: Optional[Type[JSONEncoder]] = ...,
) -> None: ...
def __enter__(self) -> Any: ...
def __exit__(self, type: Any, value: Any, traceback: Any) -> None: ...
def __enter__(self) -> Self: ...
def __exit__(self, type: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None) -> None: ...
@overload
def __call__(self, obj: type[_T]) -> type[_T]: ...
@overload
Expand Down