bpo-37383: Updates docs to reflect AsyncMock call_count after await. (GH-15761)

* bpo-351428: Updates documentation to reflect AsyncMock call_count after await.

* Adds skip and fixes warning.

* Removes extra >>>.

* Adds ... in front of await mock().
(cherry picked from commit b9f65f01fd)

Co-authored-by: Lisa Roach <lisaroach14@gmail.com>
This commit is contained in:
Miss Islington (bot) 2019-09-10 00:31:34 -07:00 committed by GitHub
parent 29bde48ade
commit d4391aa5eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 0 deletions

View File

@ -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