mirror of
https://github.com/python/cpython.git
synced 2025-08-03 00:23:06 +00:00
Issue #28735: Fixed the comparison of mock.MagickMock with mock.ANY.
This commit is contained in:
parent
6ad85bf89a
commit
362f058a89
3 changed files with 22 additions and 5 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue