Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 23 additions & 23 deletions stdlib/unittest/mock.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -204,112 +204,112 @@ class _patcher:
TEST_PREFIX: str
dict: Type[_patch_dict]
if sys.version_info >= (3, 8):
# This overload also covers the case, where new==DEFAULT. In this case, the return type is _patch[Any].
# Ideally we'd be able to add an overload for it so that the return type is _patch[MagicMock],
# but that's impossible with the current type system.
@overload
def __call__( # type: ignore
self,
target: Any,
*,
new: _T,
spec: Optional[Any] = ...,
create: bool = ...,
spec_set: Optional[Any] = ...,
autospec: Optional[Any] = ...,
new_callable: Optional[Any] = ...,
**kwargs: Any,
) -> _patch[Union[MagicMock, AsyncMock]]: ...
# This overload also covers the case, where new==DEFAULT. In this case, the return type is _patch[Any].
# Ideally we'd be able to add an overload for it so that the return type is _patch[MagicMock],
# but that's impossible with the current type system.
) -> _patch[_T]: ...
@overload
def __call__(
def __call__( # type: ignore
self,
target: Any,
new: _T,
*,
spec: Optional[Any] = ...,
create: bool = ...,
spec_set: Optional[Any] = ...,
autospec: Optional[Any] = ...,
new_callable: Optional[Any] = ...,
**kwargs: Any,
) -> _patch[_T]: ...
) -> _patch[Union[MagicMock, AsyncMock]]: ...
else:
@overload
def __call__( # type: ignore
self,
target: Any,
*,
new: _T,
spec: Optional[Any] = ...,
create: bool = ...,
spec_set: Optional[Any] = ...,
autospec: Optional[Any] = ...,
new_callable: Optional[Any] = ...,
**kwargs: Any,
) -> _patch[MagicMock]: ...
) -> _patch[_T]: ...
@overload
def __call__(
def __call__( # type: ignore
self,
target: Any,
new: _T,
*,
spec: Optional[Any] = ...,
create: bool = ...,
spec_set: Optional[Any] = ...,
autospec: Optional[Any] = ...,
new_callable: Optional[Any] = ...,
**kwargs: Any,
) -> _patch[_T]: ...
) -> _patch[MagicMock]: ...
if sys.version_info >= (3, 8):
@overload
def object( # type: ignore
self,
target: Any,
attribute: str,
*,
new: _T,
spec: Optional[Any] = ...,
create: bool = ...,
spec_set: Optional[Any] = ...,
autospec: Optional[Any] = ...,
new_callable: Optional[Any] = ...,
**kwargs: Any,
) -> _patch[Union[MagicMock, AsyncMock]]: ...
) -> _patch[_T]: ...
@overload
def object(
def object( # type: ignore
self,
target: Any,
attribute: str,
new: _T = ...,
*,
spec: Optional[Any] = ...,
create: bool = ...,
spec_set: Optional[Any] = ...,
autospec: Optional[Any] = ...,
new_callable: Optional[Any] = ...,
**kwargs: Any,
) -> _patch[_T]: ...
) -> _patch[Union[MagicMock, AsyncMock]]: ...
else:
@overload
def object( # type: ignore
self,
target: Any,
attribute: str,
*,
new: _T,
spec: Optional[Any] = ...,
create: bool = ...,
spec_set: Optional[Any] = ...,
autospec: Optional[Any] = ...,
new_callable: Optional[Any] = ...,
**kwargs: Any,
) -> _patch[MagicMock]: ...
) -> _patch[_T]: ...
@overload
def object(
def object( # type: ignore
self,
target: Any,
attribute: str,
new: _T = ...,
*,
spec: Optional[Any] = ...,
create: bool = ...,
spec_set: Optional[Any] = ...,
autospec: Optional[Any] = ...,
new_callable: Optional[Any] = ...,
**kwargs: Any,
) -> _patch[_T]: ...
) -> _patch[MagicMock]: ...
def multiple(
self,
target: Any,
Expand Down