mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
bpo-35226: Fix equality for nested unittest.mock.call objects. (#10555)
Also refactor the call recording imolementation and add some notes about its limitations.
This commit is contained in:
parent
3bc0ebab17
commit
8ca0fa9d2f
6 changed files with 125 additions and 24 deletions
|
@ -270,6 +270,22 @@ class CallTest(unittest.TestCase):
|
|||
self.assertEqual(mock.mock_calls, last_call.call_list())
|
||||
|
||||
|
||||
def test_extended_not_equal(self):
|
||||
a = call(x=1).foo
|
||||
b = call(x=2).foo
|
||||
self.assertEqual(a, a)
|
||||
self.assertEqual(b, b)
|
||||
self.assertNotEqual(a, b)
|
||||
|
||||
|
||||
def test_nested_calls_not_equal(self):
|
||||
a = call(x=1).foo().bar
|
||||
b = call(x=2).foo().bar
|
||||
self.assertEqual(a, a)
|
||||
self.assertEqual(b, b)
|
||||
self.assertNotEqual(a, b)
|
||||
|
||||
|
||||
def test_call_list(self):
|
||||
mock = MagicMock()
|
||||
mock(1)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue