/third_party/python/Lib/unittest/test/testmock/ |
D | testmagicmethods.py | 5 from unittest.mock import AsyncMock, Mock, MagicMock, _magics 12 mock = Mock() 13 self.assertFalse(hasattr(mock, '__getitem__')) 15 mock.__getitem__ = Mock() 16 self.assertTrue(hasattr(mock, '__getitem__')) 18 del mock.__getitem__ 19 self.assertFalse(hasattr(mock, '__getitem__')) 23 mock = MagicMock() 25 del mock.__getitem__ 26 self.assertRaises(TypeError, lambda: mock['foo']) [all …]
|
D | testmock.py | 9 from unittest import mock 10 from unittest.mock import ( 60 mock = Mock() 62 self.assertFalse(mock.called, "called not initialised correctly") 63 self.assertEqual(mock.call_count, 0, 65 self.assertTrue(is_instance(mock.return_value, Mock), 68 self.assertEqual(mock.call_args, None, 70 self.assertEqual(mock.call_args_list, [], 72 self.assertEqual(mock.method_calls, [], 76 self.assertNotIn('_items', mock.__dict__, [all …]
|
D | testhelpers.py | 6 from unittest.mock import ( 26 mock = Mock() 27 mock(ANY) 28 mock.assert_called_with(ANY) 30 mock = Mock() 31 mock(foo=ANY) 32 mock.assert_called_with(foo=ANY) 40 mock = Mock() 41 mock(datetime.now(), foo=datetime.now()) 43 mock.assert_called_with(ANY, foo=ANY) [all …]
|
D | testasync.py | 10 from unittest.mock import (ANY, call, AsyncMock, patch, MagicMock, Mock, 152 mock = AsyncMock() 153 self.assertTrue(iscoroutinefunction(mock)) 157 mock = AsyncMock(foo) 158 self.assertTrue(iscoroutinefunction(mock)) 159 self.assertTrue(inspect.iscoroutinefunction(mock)) 162 mock = AsyncMock() 163 m = mock() 166 self.assertIn('assert_awaited', dir(mock)) 170 mock = AsyncMock(foo) [all …]
|
D | testcallable.py | 8 from unittest.mock import ( 18 def assertNotCallable(self, mock): argument 19 self.assertTrue(is_instance(mock, NonCallableMagicMock)) 20 self.assertFalse(is_instance(mock, CallableMixin)) 24 for mock in NonCallableMagicMock(), NonCallableMock(): 25 self.assertRaises(TypeError, mock) 26 self.assertFalse(hasattr(mock, '__call__')) 27 self.assertIn(mock.__class__.__name__, repr(mock)) 59 mock = patcher.start() 62 instance = mock() [all …]
|
D | testsealable.py | 2 from unittest import mock 15 m = mock.Mock() 17 self.assertIsInstance(m.test, mock.Mock) 18 self.assertIsInstance(m.test(), mock.Mock) 19 self.assertIsInstance(m.test().test2(), mock.Mock) 22 m = mock.Mock() 24 mock.seal(m) 31 m = mock.Mock() 33 mock.seal(m) 38 m = mock.Mock() [all …]
|
D | testwith.py | 5 from unittest.mock import MagicMock, Mock, patch, sentinel, mock_open, call 68 mock = Mock() 69 mock.__enter__ = Mock() 70 mock.__exit__ = Mock() 71 mock.__exit__.return_value = False 73 with mock as m: 74 self.assertEqual(m, mock.__enter__.return_value) 75 mock.__enter__.assert_called_with() 76 mock.__exit__.assert_called_with(None, None, None) 80 mock = MagicMock() [all …]
|
/third_party/node/test/parallel/ |
D | test-runner-mock-timers.js | 6 const { it, mock, describe } = require('node:test'); 14 t.mock.timers.enable(['DOES_NOT_EXIST']); 21 t.mock.timers.enable(); 23 t.mock.timers.enable(); 30 t.mock.timers.reset(); 35 t.mock.timers.tick(); 42 t.mock.timers.enable(); 44 t.mock.timers.tick(-1); 76 t.mock.timers.enable(); 78 t.mock.timers.reset(); [all …]
|
D | test-runner-mocking.js | 4 const { mock, test } = require('node:test'); 6 const sum = t.mock.fn((arg1, arg2) => { 10 assert.strictEqual(sum.mock.calls.length, 0); 13 assert.strictEqual(sum.mock.calls.length, 2); 15 let call = sum.mock.calls[0]; 22 call = sum.mock.calls[1]; 34 const sum = t.mock.fn(bound); 36 assert.strictEqual(sum.mock.calls.length, 0); 39 assert.strictEqual(sum.mock.calls.length, 2); 41 let call = sum.mock.calls[0]; [all …]
|
/third_party/googletest/googlemock/test/ |
D | gmock_link_test.h | 248 Mock mock; in TEST() local 250 EXPECT_CALL(mock, VoidFromString(_)).WillOnce(Return()); in TEST() 251 mock.VoidFromString(nullptr); in TEST() 256 Mock mock; in TEST() local 259 EXPECT_CALL(mock, StringFromString(_)).WillOnce(Return(&ch)); in TEST() 260 mock.StringFromString(nullptr); in TEST() 265 Mock mock; in TEST() local 267 EXPECT_CALL(mock, VoidFromString(_)).WillOnce(Return()); in TEST() 268 mock.VoidFromString(nullptr); in TEST() 273 Mock mock; in TEST() local [all …]
|
D | gmock-actions_test.cc | 698 MockFunction<Result()> mock; in TEST() local 699 EXPECT_CALL(mock, Call) in TEST() 703 EXPECT_THAT(mock.AsStdFunction()(), in TEST() 706 EXPECT_THAT(mock.AsStdFunction()(), in TEST() 736 MockFunction<Out()> mock; in TEST() local 737 EXPECT_CALL(mock, Call).WillOnce(Return(In())); in TEST() 738 EXPECT_THAT(mock.AsStdFunction()(), Field(&Out::x, 19)); in TEST() 752 MockFunction<U()> mock; in TEST() local 753 EXPECT_CALL(mock, Call).WillOnce(Return(17)).WillRepeatedly(Return(19)); in TEST() 755 EXPECT_EQ(17, mock.AsStdFunction()()); in TEST() [all …]
|
/third_party/python/Lib/test/ |
D | test_getpass.py | 5 from unittest import mock 17 @mock.patch('os.environ') 33 [mock.call(x) for x in ('LOGNAME', 'USER', 'LNAME', 'USERNAME')]) 39 with mock.patch('os.getuid') as uid, \ 40 mock.patch('pwd.getpwuid') as getpw: 54 stream = mock.Mock(spec=StringIO) 62 with mock.patch('sys.stderr') as stderr: 66 @mock.patch('sys.stdin') 72 @mock.patch('sys.stdin') 98 with mock.patch('os.open') as open, \ [all …]
|
D | test_ensurepip.py | 8 import unittest.mock 24 with (unittest.mock.patch.object(ensurepip, '_PACKAGES', None), 25 unittest.mock.patch.object(ensurepip, '_WHEEL_PKG_DIR', tmpdir)): 30 with (unittest.mock.patch.object(ensurepip, '_PACKAGES', None), 31 unittest.mock.patch.object(ensurepip, '_WHEEL_PKG_DIR', None)): 52 with (unittest.mock.patch.object(ensurepip, '_PACKAGES', None), 53 unittest.mock.patch.object(ensurepip, '_WHEEL_PKG_DIR', tmpdir)): 70 run_pip_patch = unittest.mock.patch("ensurepip._run_pip") 77 os_patch = unittest.mock.patch("ensurepip.os") 95 unittest.mock.ANY, "setuptools", "pip", [all …]
|
D | test_script_helper.py | 8 from unittest import mock 38 @mock.patch('subprocess.Popen') 40 with mock.patch.object(script_helper, 56 @mock.patch('subprocess.Popen') 59 with mock.patch.object(script_helper, 85 @mock.patch('subprocess.check_call') 87 with mock.patch.dict(os.environ): 94 @mock.patch('subprocess.check_call') 96 with mock.patch.dict(os.environ): 103 @mock.patch('subprocess.check_call') [all …]
|
/third_party/node/deps/npm/test/lib/utils/ |
D | reify-finish.js | 15 const mock = await mockNpm(t, { constant 30 await reifyFinish(mock.npm, { 31 options: { global: mock.npm.global }, 32 actualTree: typeof actualTree === 'function' ? actualTree(mock) : actualTree, 36 raw: await readRc(mock.other), 37 data: Object.fromEntries(Object.entries(mock.npm.config.data.get('builtin').data)), 42 ...mock, 47 const mock = await mockReififyFinish(t, { constant 50 t.same(mock.builtinRc.raw, 'key=value') 51 t.strictSame(mock.builtinRc.data, { key: 'value' }) [all …]
|
/third_party/mesa3d/bin/ |
D | post_version_test.py | 21 from unittest import mock 28 @mock.patch('bin.post_version.subprocess.run', mock.Mock()) 34 with mock.patch('bin.post_version.subprocess.run', mock.Mock()), \ 35 mock.patch('bin.post_version.pathlib', mock.MagicMock()): 44 m = mock.Mock() 45 with mock.patch('bin.post_version.csv.reader', mock.Mock(return_value=data.copy())), \ 46 mock.patch('bin.post_version.csv.writer', mock.Mock(return_value=m)): 59 m = mock.Mock() 60 with mock.patch('bin.post_version.csv.reader', mock.Mock(return_value=data.copy())), \ 61 mock.patch('bin.post_version.csv.writer', mock.Mock(return_value=m)):
|
/third_party/python/Doc/library/ |
D | unittest.mock.rst | 2 :mod:`unittest.mock` --- mock object library 5 .. module:: unittest.mock 9 .. currentmodule:: unittest.mock 13 **Source code:** :source:`Lib/unittest/mock.py` 17 :mod:`unittest.mock` is a library for testing in Python. It allows you to 18 replace parts of your system under test with mock objects and make assertions 21 :mod:`unittest.mock` provides a core :class:`Mock` class removing the need to 27 Additionally, mock provides a :func:`patch` decorator that handles patching 37 There is a backport of :mod:`unittest.mock` for earlier versions of Python, 38 available as `mock on PyPI <https://pypi.org/project/mock>`_. [all …]
|
D | unittest.mock-examples.rst | 1 :mod:`unittest.mock` --- getting started 5 .. currentmodule:: unittest.mock 17 from unittest.mock import Mock, MagicMock, AsyncMock, patch, call, sentinel 45 Once our mock has been used (``real.method`` in this example) it has methods 54 Once the mock has been called its :attr:`~Mock.called` attribute is set to 95 >>> mock = Mock() 96 >>> real.closer(mock) 97 >>> mock.close.assert_called_with() 99 We don't have to do any work to provide the 'close' method on our mock. 108 A common use case is to mock out classes instantiated by your code under test. [all …]
|
/third_party/mbedtls/tests/suites/ |
D | test_suite_psa_crypto_se_driver_hal_mocks.data | 1 SE init mock test: success 4 SE init mock test: failure 7 SE init mock test: invalid location (0) 10 SE init mock test: location not supported (INT_MAX) 13 SE key importing mock test 16 SE key importing mock test: max key bits 19 SE key importing mock test: more than max key bits 22 SE key importing mock test: alloc failed 25 SE key importing mock test: import failed 28 SE key exporting mock test [all …]
|
/third_party/node/deps/v8/tools/clusterfuzz/foozzie/ |
D | v8_mock_archs.js | 20 const mock = function(type) { function 49 ArrayBuffer = mock(ArrayBuffer); 50 SharedArrayBuffer = mock(SharedArrayBuffer); 51 Int8Array = mock(Int8Array); 52 Uint8Array = mock(Uint8Array); 53 Uint8ClampedArray = mock(Uint8ClampedArray); 54 Int16Array = mock(Int16Array); 55 Uint16Array = mock(Uint16Array); 56 Int32Array = mock(Int32Array); 57 Uint32Array = mock(Uint32Array); [all …]
|
/third_party/mesa3d/bin/pick/ |
D | core_test.py | 23 from unittest import mock 250 async def mock(self, *_, **__): member in TestResolveNomination.FakeSubprocess 274 with mock.patch('bin.pick.core.asyncio.create_subprocess_exec', s.mock): 275 with mock.patch('bin.pick.core.is_commit_in_branch', self.return_true): 286 with mock.patch('bin.pick.core.asyncio.create_subprocess_exec', s.mock): 287 with mock.patch('bin.pick.core.is_commit_in_branch', self.return_false): 298 with mock.patch('bin.pick.core.asyncio.create_subprocess_exec', s.mock): 309 with mock.patch('bin.pick.core.asyncio.create_subprocess_exec', s.mock): 320 with mock.patch('bin.pick.core.asyncio.create_subprocess_exec', s.mock): 331 with mock.patch('bin.pick.core.asyncio.create_subprocess_exec', s.mock): [all …]
|
/third_party/python/Lib/test/test_importlib/import_/ |
D | test_packages.py | 13 with util.mock_spec('pkg.__init__', 'pkg.module') as mock: 14 with util.import_state(meta_path=[mock]): 19 with util.mock_spec('pkg.module') as mock: 20 with util.import_state(meta_path=[mock]): 29 mock = util.mock_spec('pkg.__init__', 'pkg.module', 31 with mock: 32 with util.import_state(meta_path=[mock]): 46 mock = util.mock_spec('pkg.__init__', 'pkg.module', 48 with mock: 49 with util.import_state(meta_path=[mock]): [all …]
|
/third_party/python/Lib/test/test_asyncio/ |
D | test_selector_events.py | 6 from unittest import mock 20 MOCK_ANY = mock.ANY 30 self._ssock = mock.Mock() 31 self._csock = mock.Mock() 55 self.selector = mock.Mock() 61 m = mock.Mock() 62 self.loop.add_reader = mock.Mock() 75 m = mock.Mock() 76 self.loop._add_reader = mock.Mock() 78 self.loop._add_writer = mock.Mock() [all …]
|
D | test_unix_events.py | 15 from unittest import mock 29 MOCK_ANY = mock.ANY 73 h = asyncio.Handle(mock.Mock(), (), 74 loop=mock.Mock()) 77 self.loop.remove_signal_handler = mock.Mock() 81 @mock.patch('asyncio.unix_events.signal') 92 @mock.patch('asyncio.unix_events.signal') 109 @mock.patch('asyncio.unix_events.signal') 120 @mock.patch('asyncio.unix_events.signal') 139 @mock.patch('asyncio.unix_events.signal') [all …]
|
/third_party/skia/infra/bots/task_drivers/perf_puppeteer_render_skps/ |
D | perf_puppeteer_render_skps_test.go | 29 mock := exec.CommandCollector{} 30 ctx = td.WithExecRunFn(ctx, mock.Run) 36 cmds := mock.Commands() 73 mock := exec.CommandCollector{} 74 ctx = td.WithExecRunFn(ctx, mock.Run) 80 require.Len(t, mock.Commands(), 1) 81 cmd := mock.Commands()[0] 114 mock := exec.CommandCollector{} 115 ctx = td.WithExecRunFn(ctx, mock.Run) 122 require.Len(t, mock.Commands(), 0) [all …]
|