Commit e7cb23bf authored by Xtreak's avatar Xtreak Committed by Miss Islington (bot)

Fix RuntimeWarning in unittest.mock asyncio example (GH-13449)



* This PR fixes the `RuntimeWarning` in `inspect.isawaitable(mock())` where `mock()` was not awaited.
* Fix typo in asynctest project.
parent d0ebf13e
...@@ -862,7 +862,7 @@ object:: ...@@ -862,7 +862,7 @@ object::
>>> mock = AsyncMock() >>> mock = AsyncMock()
>>> asyncio.iscoroutinefunction(mock) >>> asyncio.iscoroutinefunction(mock)
True True
>>> inspect.isawaitable(mock()) >>> inspect.isawaitable(mock()) # doctest: +SKIP
True True
The result of ``mock()`` is an async function which will have the outcome The result of ``mock()`` is an async function which will have the outcome
...@@ -888,7 +888,7 @@ object:: ...@@ -888,7 +888,7 @@ object::
>>> mock = MagicMock(async_func) >>> mock = MagicMock(async_func)
>>> mock >>> mock
<MagicMock spec='function' id='...'> <MagicMock spec='function' id='...'>
>>> mock() >>> mock() # doctest: +SKIP
<coroutine object AsyncMockMixin._mock_call at ...> <coroutine object AsyncMockMixin._mock_call at ...>
.. method:: assert_awaited() .. method:: assert_awaited()
......
...@@ -2204,7 +2204,7 @@ class AsyncMock(AsyncMockMixin, AsyncMagicMixin, Mock): ...@@ -2204,7 +2204,7 @@ class AsyncMock(AsyncMockMixin, AsyncMagicMixin, Mock):
:class:`.Mock` object: the wrapped object may have methods :class:`.Mock` object: the wrapped object may have methods
defined as async function functions. defined as async function functions.
Based on Martin Richard's asyntest project. Based on Martin Richard's asynctest project.
""" """
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment