diff options
| author | Chris Withers <chris@withers.org> | 2018-12-03 21:31:37 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-12-03 21:31:37 +0000 |
| commit | 8ca0fa9d2f4de6e69f0902790432e0ab2f37ba68 (patch) | |
| tree | c1af80e0a0ee140f84cf87b02caca5e5d9ed67d5 /Lib/unittest/test/testmock/testhelpers.py | |
| parent | 3bc0ebab17bf5a2c29d2214743c82034f82e6573 (diff) | |
| download | cpython-git-8ca0fa9d2f4de6e69f0902790432e0ab2f37ba68.tar.gz | |
bpo-35226: Fix equality for nested unittest.mock.call objects. (#10555)
Also refactor the call recording imolementation and add some notes
about its limitations.
Diffstat (limited to 'Lib/unittest/test/testmock/testhelpers.py')
| -rw-r--r-- | Lib/unittest/test/testmock/testhelpers.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Lib/unittest/test/testmock/testhelpers.py b/Lib/unittest/test/testmock/testhelpers.py index 9edebf5516..9388311e3e 100644 --- a/Lib/unittest/test/testmock/testhelpers.py +++ b/Lib/unittest/test/testmock/testhelpers.py @@ -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) |
