[New-bugs-announce] [issue38163] AsyncMock child mocks should detect their type
Lisa Roach
report at bugs.python.org
Fri Sep 13 13:05:04 EDT 2019
New submission from Lisa Roach <lisaroach14 at gmail.com>:
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 <report at bugs.python.org>
<https://bugs.python.org/issue38163>
_______________________________________
More information about the New-bugs-announce
mailing list