summaryrefslogtreecommitdiffstats
path: root/Lib/unittest/test
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2017-01-21 21:12:58 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2017-01-21 21:12:58 (GMT)
commit362f058a89437f82f112cda439bb40abe4ddb8c5 (patch)
tree611247b1a867cddbd466c646d95665ed8508acbc /Lib/unittest/test
parent6ad85bf89a0524637a89f2950468d2630929fdb2 (diff)
downloadcpython-362f058a89437f82f112cda439bb40abe4ddb8c5.zip
cpython-362f058a89437f82f112cda439bb40abe4ddb8c5.tar.gz
cpython-362f058a89437f82f112cda439bb40abe4ddb8c5.tar.bz2
Issue #28735: Fixed the comparison of mock.MagickMock with mock.ANY.
Diffstat (limited to 'Lib/unittest/test')
-rw-r--r--Lib/unittest/test/testmock/testmock.py17
1 files changed, 14 insertions, 3 deletions
diff --git a/Lib/unittest/test/testmock/testmock.py b/Lib/unittest/test/testmock/testmock.py
index 5f82b82..a96ec68 100644
--- a/Lib/unittest/test/testmock/testmock.py
+++ b/Lib/unittest/test/testmock/testmock.py
@@ -306,13 +306,24 @@ class MockTest(unittest.TestCase):
def test_calls_equal_with_any(self):
- call1 = mock.call(mock.MagicMock())
- call2 = mock.call(mock.ANY)
-
# Check that equality and non-equality is consistent even when
# comparing with mock.ANY
+ mm = mock.MagicMock()
+ self.assertTrue(mm == mm)
+ self.assertFalse(mm != mm)
+ self.assertFalse(mm == mock.MagicMock())
+ self.assertTrue(mm != mock.MagicMock())
+ self.assertTrue(mm == mock.ANY)
+ self.assertFalse(mm != mock.ANY)
+ self.assertTrue(mock.ANY == mm)
+ self.assertFalse(mock.ANY != mm)
+
+ call1 = mock.call(mock.MagicMock())
+ call2 = mock.call(mock.ANY)
self.assertTrue(call1 == call2)
self.assertFalse(call1 != call2)
+ self.assertTrue(call2 == call1)
+ self.assertFalse(call2 != call1)
def test_assert_called_with(self):