New submission from Lisa Roach <[email protected]>:
We want child mocks to match their "type" (async or sync).
Ex:
class Prod:
async def foo():
pass
def bar():
pass
a_mock = AsyncMock(Prod)
isinstance(a_mock.foo(), AsyncMock) == True
isinstance(a_mock.bar(), MagicMock) == True
Also this should include magic methods:
int(a_mock) should work and return 1 like MagicMocks do.
a_mock.__enter__ should exist and be a MagicMock, just as a_mock.__aenter__
exists and is an AsyncMock.
----------
messages: 352369
nosy: lisroach
priority: normal
severity: normal
status: open
title: AsyncMock child mocks should detect their type
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue38163>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com