Home
last modified time | relevance | path

Searched refs:AsyncMock (Results 1 – 12 of 12) sorted by relevance

/external/python/cpython3/Lib/unittest/test/testmock/
Dtestasync.py10 from unittest.mock import (ANY, call, AsyncMock, patch, MagicMock, Mock,
82 self.assertIsInstance(mock_method, AsyncMock)
89 self.assertIsInstance(mock_method, AsyncMock)
96 self.assertIsInstance(mock_method, AsyncMock)
107 self.assertIsInstance(async_func, AsyncMock)
108 self.assertIsInstance(async_func_args, AsyncMock)
137 self.assertIsInstance(mock_method, AsyncMock)
143 with patch(f"{__name__}.async_func", AsyncMock()):
144 self.assertIsInstance(async_func, AsyncMock)
152 mock = AsyncMock()
[all …]
Dtestmagicmethods.py5 from unittest.mock import AsyncMock, Mock, MagicMock, _magics
274 mock = AsyncMock()
290 self.assertIsInstance(mock.__aenter__, AsyncMock)
291 self.assertIsInstance(mock.__aexit__, AsyncMock)
316 self.assertIsInstance(mock.__aenter__, AsyncMock)
317 self.assertIsInstance(mock.__aexit__, AsyncMock)
Dtestmock.py13 NonCallableMagicMock, AsyncMock, _Call, _CallList,
1779 AsyncMock):
2152 Mock, MagicMock, NonCallableMock, NonCallableMagicMock, AsyncMock
/external/python/cpython3/Doc/library/
Dunittest.mock.rst208 from unittest.mock import patch, call, Mock, MagicMock, PropertyMock, AsyncMock
858 .. class:: AsyncMock(spec=None, side_effect=None, return_value=DEFAULT, wraps=None, name=None, spec…
860 An asynchronous version of :class:`MagicMock`. The :class:`AsyncMock` object will
864 >>> mock = AsyncMock()
882 returns a new :class:`AsyncMock` object.
897 Setting the *spec* of a :class:`Mock`, :class:`MagicMock`, or :class:`AsyncMock`
900 parent mock is :class:`AsyncMock` or :class:`MagicMock`) or :class:`Mock` (if
902 :class:`AsyncMock`.
910 >>> a_mock = AsyncMock(ExampleClass)
914 <AsyncMock name='mock.async_foo' id='...'>
[all …]
Dunittest.mock-examples.rst17 from unittest.mock import Mock, MagicMock, AsyncMock, patch, call, sentinel
283 Since Python 3.8, ``AsyncMock`` and ``MagicMock`` have support to mock
288 >>> mock = MagicMock() # AsyncMock also works here
300 Since Python 3.8, ``AsyncMock`` and ``MagicMock`` have support to mock
302 By default, ``__aenter__`` and ``__aexit__`` are ``AsyncMock`` instances that
311 >>> mock_instance = MagicMock(AsyncContextManager()) # AsyncMock also works here
/external/python/cpython3/Lib/unittest/
Dmock.py48 if _is_instance_mock(obj) and not isinstance(obj, AsyncMock):
993 return AsyncMock(**kw)
998 klass = AsyncMock
1005 klass = AsyncMock
1429 Klass = AsyncMock
1444 Klass = AsyncMock
2304 class AsyncMock(AsyncMockMixin, AsyncMagicMixin, Mock): class
2615 Klass = AsyncMock
2681 child_klass = AsyncMock
/external/python/cpython3/Misc/NEWS.d/
D3.9.0a2.rst507 AsyncMock now returns StopAsyncIteration on the exhaustion of a side_effects
518 AsyncMock fix for return values that are awaitable types. This also covers
D3.9.0a1.rst1471 Removes _AwaitEvent from AsyncMock.
1502 Any synchronous magic methods on an AsyncMock now return a MagicMock. Any
1503 asynchronous magic methods on a MagicMock now return an AsyncMock.
1591 Changes AsyncMock call count and await count to be two different counters.
1776 Fixes AsyncMock so it doesn't crash when used with AsyncContextManagers or
1816 Remove `__code__` check in AsyncMock that incorrectly evaluated function
D3.9.0a4.rst528 Allow AsyncMock to correctly patch static/class methods
D3.8.0b1.rst635 Handle late binding and attribute access in :class:`unittest.mock.AsyncMock`
1429 Added AsyncMock to support using unittest to mock asyncio coroutines. Patch
D3.9.0a5.rst483 Ensure :attr:`unittest.mock.AsyncMock.await_args_list` has call objects in
/external/python/cpython3/Doc/whatsnew/
D3.8.rst1359 Added :class:`~unittest.mock.AsyncMock` to support an asynchronous version of