mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
bpo-39082: Allow AsyncMock to correctly patch static/class methods (GH-18116)
This commit is contained in:
parent
d0d9fa8c5e
commit
62865f4532
3 changed files with 26 additions and 0 deletions
|
@ -46,6 +46,8 @@ _safe_super = super
|
|||
def _is_async_obj(obj):
|
||||
if _is_instance_mock(obj) and not isinstance(obj, AsyncMock):
|
||||
return False
|
||||
if hasattr(obj, '__func__'):
|
||||
obj = getattr(obj, '__func__')
|
||||
return asyncio.iscoroutinefunction(obj) or inspect.isawaitable(obj)
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue