Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions Doc/library/unittest.mock.rst
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,20 @@ the *new_callable* argument to :func:`patch`.
>>> mock.call_count
2

For :class:`AsyncMock` the :attr:`call_count` is only iterated if the function
has been awaited:

>>> mock = AsyncMock()
>>> mock() # doctest: +SKIP
<coroutine object AsyncMockMixin._mock_call at ...>
>>> mock.call_count
0
>>> async def main():
... await mock()
...
>>> asyncio.run(main())
>>> mock.call_count
1

.. attribute:: return_value

Expand Down