[New-bugs-announce] [issue38163] AsyncMock child mocks should detect their type
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).
async def foo():
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.
title: AsyncMock child mocks should detect their type
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce