Add a more precise signature for AsyncMock.reset_mock() (#10481)

This commit is contained in:
Nikita Sobolev
2023-07-19 15:25:20 +03:00
committed by GitHub
parent 9e7477d986
commit 032f9195f9
2 changed files with 11 additions and 2 deletions

View File

@@ -389,7 +389,11 @@ if sys.version_info >= (3, 8):
class AsyncMagicMixin(MagicMixin):
def __init__(self, *args: Any, **kw: Any) -> None: ...
class AsyncMock(AsyncMockMixin, AsyncMagicMixin, Mock): ...
class AsyncMock(AsyncMockMixin, AsyncMagicMixin, Mock):
# Improving the `reset_mock` signature.
# It is defined on `AsyncMockMixin` with `*args, **kwargs`, which is not ideal.
# But, `NonCallableMock` super-class has the better version.
def reset_mock(self, visited: Any = None, *, return_value: bool = False, side_effect: bool = False) -> None: ...
class MagicProxy:
name: str

View File

@@ -329,7 +329,12 @@ class AsyncMockMixin(Base):
__annotations__: dict[str, Any] | None # type: ignore[assignment]
class AsyncMagicMixin(MagicMixin): ...
class AsyncMock(AsyncMockMixin, AsyncMagicMixin, Mock): ...
class AsyncMock(AsyncMockMixin, AsyncMagicMixin, Mock):
# Improving the `reset_mock` signature.
# It is defined on `AsyncMockMixin` with `*args, **kwargs`, which is not ideal.
# But, `NonCallableMock` super-class has the better version.
def reset_mock(self, visited: Any = None, *, return_value: bool = False, side_effect: bool = False) -> None: ...
class MagicProxy(Base):
name: str