MCPcopy Create free account
hub / github.com/python/cpython / test_extended_call

Method test_extended_call

Lib/test/test_unittest/testmock/testhelpers.py:280–297  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

278
279
280 def test_extended_call(self):
281 result = call(1).foo(2).bar(3, a=4)
282 self.assertEqual(result, ('().foo().bar', (3,), dict(a=4)))
283
284 mock = MagicMock()
285 mock(1, 2, a=3, b=4)
286 self.assertEqual(mock.call_args, call(1, 2, a=3, b=4))
287 self.assertNotEqual(mock.call_args, call(1, 2, 3))
288
289 self.assertEqual(mock.call_args_list, [call(1, 2, a=3, b=4)])
290 self.assertEqual(mock.mock_calls, [call(1, 2, a=3, b=4)])
291
292 mock = MagicMock()
293 mock.foo(1).bar()().baz.beep(a=6)
294
295 last_call = call.foo(1).bar()().baz.beep(a=6)
296 self.assertEqual(mock.mock_calls[-1], last_call)
297 self.assertEqual(mock.mock_calls, last_call.call_list())
298
299
300 def test_extended_not_equal(self):

Callers

nothing calls this directly

Calls 8

MagicMockClass · 0.90
assertNotEqualMethod · 0.80
call_listMethod · 0.80
callFunction · 0.50
barMethod · 0.45
fooMethod · 0.45
assertEqualMethod · 0.45
beepMethod · 0.45

Tested by

no test coverage detected