mirror of
https://github.com/python/cpython.git
synced 2025-07-24 03:35:53 +00:00
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.
This commit is contained in:
parent
d0ebf13e50
commit
e7cb23bf20
2 changed files with 3 additions and 3 deletions
|
@ -862,7 +862,7 @@ object::
|
|||
>>> mock = AsyncMock()
|
||||
>>> asyncio.iscoroutinefunction(mock)
|
||||
True
|
||||
>>> inspect.isawaitable(mock())
|
||||
>>> inspect.isawaitable(mock()) # doctest: +SKIP
|
||||
True
|
||||
|
||||
The result of ``mock()`` is an async function which will have the outcome
|
||||
|
@ -888,7 +888,7 @@ object::
|
|||
>>> mock = MagicMock(async_func)
|
||||
>>> mock
|
||||
<MagicMock spec='function' id='...'>
|
||||
>>> mock()
|
||||
>>> mock() # doctest: +SKIP
|
||||
<coroutine object AsyncMockMixin._mock_call at ...>
|
||||
|
||||
.. method:: assert_awaited()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue