(self)
| 1353 | |
| 1354 | |
| 1355 | def test_arg_lists(self): |
| 1356 | mocks = [ |
| 1357 | Mock(), |
| 1358 | MagicMock(), |
| 1359 | NonCallableMock(), |
| 1360 | NonCallableMagicMock() |
| 1361 | ] |
| 1362 | |
| 1363 | def assert_attrs(mock): |
| 1364 | names = 'call_args_list', 'method_calls', 'mock_calls' |
| 1365 | for name in names: |
| 1366 | attr = getattr(mock, name) |
| 1367 | self.assertIsInstance(attr, _CallList) |
| 1368 | self.assertIsInstance(attr, list) |
| 1369 | self.assertEqual(attr, []) |
| 1370 | |
| 1371 | for mock in mocks: |
| 1372 | assert_attrs(mock) |
| 1373 | |
| 1374 | if callable(mock): |
| 1375 | mock() |
| 1376 | mock(1, 2) |
| 1377 | mock(a=3) |
| 1378 | |
| 1379 | mock.reset_mock() |
| 1380 | assert_attrs(mock) |
| 1381 | |
| 1382 | mock.foo() |
| 1383 | mock.foo.bar(1, a=3) |
| 1384 | mock.foo(1).bar().baz(3) |
| 1385 | |
| 1386 | mock.reset_mock() |
| 1387 | assert_attrs(mock) |
| 1388 | |
| 1389 | |
| 1390 | def test_call_args_two_tuple(self): |
nothing calls this directly
no test coverage detected