Lines Matching refs:AsyncMock
10 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()
157 mock = AsyncMock(foo)
162 mock = AsyncMock()
170 mock = AsyncMock(foo)
180 mock = AsyncMock(fut)
188 self.assertIsInstance(mock_method.async_method, AsyncMock)
204 self.assertIsInstance(create_autospec(awaitable_mock), AsyncMock)
238 self.assertIsInstance(mock_method.mock, AsyncMock)
272 self.assertIsInstance(mock.async_method, AsyncMock)
275 for mock_type in [AsyncMock, MagicMock]:
281 self.assertIsInstance(mock.async_method, AsyncMock)
294 for mock_type in [AsyncMock, MagicMock, Mock]:
308 for mock_type in [AsyncMock, MagicMock, Mock]:
313 mock = AsyncMock(spec=normal_func)
314 self.assertIsInstance(mock, AsyncMock)
320 mock = AsyncMock(normal_func)
321 self.assertIsInstance(mock, AsyncMock)
329 self.assertIsInstance(mock_method, AsyncMock)
337 self.assertIsInstance(mock_method.async_method, AsyncMock)
353 self.assertIsInstance(mock_async_func, AsyncMock)
359 self.assertIsInstance(MockNormalClass.async_method, AsyncMock)
369 self.assertIsInstance(async_method, AsyncMock)
373 mock = AsyncMock(spec_set=AsyncClass.async_method)
375 self.assertIsInstance(mock, AsyncMock)
381 self.assertIsInstance(mock.async_method, AsyncMock)
397 mock = AsyncMock(addition, return_value=10)
404 mock = AsyncMock(addition, side_effect=Exception('err'))
411 mock = AsyncMock(side_effect=addition)
418 mock = AsyncMock(side_effect=addition)
424 mock = AsyncMock(side_effect=vals)
436 mock = AsyncMock(side_effect=vals)
443 value = AsyncMock(return_value=10)
444 mock = AsyncMock(return_value=value)
451 mock = AsyncMock(return_value=fut)
459 mock = AsyncMock(side_effect=[fut])
467 effect = AsyncMock(return_value=10)
468 mock = AsyncMock(side_effect=effect)
482 mock = AsyncMock(wraps=inner)
497 mock = AsyncMock(wraps=inner)
504 async_mock = AsyncMock()
517 self.assertIsInstance(m_mock.__aenter__, AsyncMock)
518 self.assertIsInstance(m_mock.__aexit__, AsyncMock)
519 self.assertIsInstance(m_mock.__anext__, AsyncMock)
525 a_mock = AsyncMock()
538 a_mock = AsyncMock()
546 self.assertIsInstance(m_mock.__aenter__, AsyncMock)
547 self.assertIsInstance(m_mock.__aexit__, AsyncMock)
579 response = AsyncMock(name='response')
580 response.json = AsyncMock(return_value={'json': 123})
586 for mock_type in [AsyncMock, MagicMock]:
611 for mock_type in [AsyncMock, MagicMock]:
676 mock_iter = AsyncMock(name="tester")
695 for mock_type in [AsyncMock, MagicMock]:
724 for mock_type in [AsyncMock, MagicMock]:
737 self.mock = AsyncMock()
746 mock = AsyncMock(AsyncClass)
759 mock = AsyncMock(AsyncClass)
786 mock = AsyncMock(AsyncClass)
800 mock = AsyncMock(AsyncClass)
845 a_class_mock = AsyncMock(AsyncClass)
894 a_mock = AsyncMock(AsyncClass)
998 mock_with_spec = AsyncMock(spec=Foo)
1037 self.mock = AsyncMock(spec=f)