PyDocs

Nav

Development Tools

AsyncMock.assert_awaited

  • AsyncMock.assert_awaited()
Assert that the mock was awaited at least once.
1 Example
>>> mock = AsyncMock()
>>> async def main(coroutine_mock):
...     await coroutine_mock
...
>>> coroutine_mock = mock()
>>> mock.called
True
>>> mock.assert_awaited()
Traceback (most recent call last):
...
AssertionError: Expected mock to have been awaited.
>>> asyncio.run(main(coroutine_mock))
>>> mock.assert_awaited()
from the Python docs
See Also
No see-alsos for unittest.mock/AsyncMock.assert_awaited
0 Notes
No notes for AsyncMock.assert_awaited