PyDocs

Nav

Development Tools

AsyncMock.assert_any_await

  • AsyncMock.assert_any_await(*args, **kwargs)
Assert the mock has ever been awaited with the specified arguments.
1 Example
>>> mock = AsyncMock()
>>> async def main(*args, **kwargs):
...     await mock(*args, **kwargs)
...
>>> asyncio.run(main('foo', bar='bar'))
>>> asyncio.run(main('hello'))
>>> mock.assert_any_await('foo', bar='bar')
>>> mock.assert_any_await('other')
Traceback (most recent call last):
...
AssertionError: mock('other') await not found
from the Python docs
See Also
No see-alsos for unittest.mock/AsyncMock.assert_any_await
0 Notes
No notes for AsyncMock.assert_any_await