unittest.mock: add decorate_async_callable, use tuple methods (#6438)

Co-authored-by: hauntsaninja <>
This commit is contained in:
Shantanu
2021-11-28 21:55:47 -08:00
committed by GitHub
parent 5434243f65
commit 238dff64c9

View File

@@ -1,5 +1,5 @@
import sys
from typing import Any, Callable, Generic, Iterable, List, Mapping, Sequence, Tuple, Type, TypeVar, overload
from typing import Any, Awaitable, Callable, Generic, Iterable, List, Mapping, Sequence, Tuple, Type, TypeVar, overload
_T = TypeVar("_T")
_TT = TypeVar("_TT", bound=Type[Any])
@@ -53,8 +53,6 @@ class _Call(Tuple[Any, ...]):
__ne__: Any
def __call__(self, *args: Any, **kwargs: Any) -> _Call: ...
def __getattr__(self, attr: Any) -> Any: ...
def count(self, *args: Any, **kwargs: Any) -> Any: ...
def index(self, *args: Any, **kwargs: Any) -> Any: ...
def call_list(self) -> Any: ...
call: _Call
@@ -181,6 +179,8 @@ class _patch(Generic[_T]):
def __call__(self, func: Callable[..., _R]) -> Callable[..., _R]: ...
def decorate_class(self, klass: _TT) -> _TT: ...
def decorate_callable(self, func: Callable[..., _R]) -> Callable[..., _R]: ...
if sys.version_info >= (3, 8):
def decorate_async_callable(self, func: Callable[..., Awaitable[_R]]) -> Callable[..., Awaitable[_R]]: ...
def get_original(self) -> tuple[Any, bool]: ...
target: Any
temp_original: Any