PyDocs

Nav

Development Tools

AsyncMock.assert_awaited_once

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