]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-37555: Regression test demonstrating assert_has_calls not working with ANY and...
authorElizabeth Uselton <elizabeth.uselton@rover.com>
Sun, 14 Jul 2019 20:53:09 +0000 (13:53 -0700)
committerElizabeth Uselton <elizabeth.uselton@rover.com>
Sun, 14 Jul 2019 20:53:09 +0000 (13:53 -0700)
Co-authored-by: Neal Finne <neal@nealfinne.com>
Lib/unittest/test/testmock/testhelpers.py

index 301bca430c131c5fcce7f8460ba9c2689f1c7b77..49fffa38439fea14e296398edcb471315a71c63e 100644 (file)
@@ -63,7 +63,19 @@ class AnyTest(unittest.TestCase):
             ]
             self.assertEqual(expected, mock.mock_calls)
             self.assertEqual(mock.mock_calls, expected)
+            mock.assert_has_calls(expected)
 
+    def test_assert_has_calls_with_any_and_spec_set(self):
+        # This is a regression test for bpo-37555
+        class Foo(object):
+            def __eq__(self, other): pass
+            def __ne__(self, other): pass
+
+        mock = Mock(spec_set=Foo)
+        expected = [call(ANY)]
+        mock(Foo())
+
+        mock.assert_has_calls(expected)
 
 
 class CallTest(unittest.TestCase):