]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Revert "bpo-37555: cleaning up changes unnecessary to the final product"
authorElizabeth Uselton <elizabeth.uselton@rover.com>
Mon, 22 Jul 2019 01:44:37 +0000 (18:44 -0700)
committerElizabeth Uselton <elizabeth.uselton@rover.com>
Mon, 22 Jul 2019 01:44:37 +0000 (18:44 -0700)
This reverts commit 18e964ba0126d8964d89842cb95534b63c2d326e.

Lib/unittest/mock.py

index 95c728fa6604abdcbba75d235f879fd06b353d38..a09671a0324869ba3a0d1422da63a3738cace82f 100644 (file)
@@ -337,13 +337,19 @@ class _CallList(list):
 
         for i in range(0, len_self - len_value + 1):
             sub_list = self[i:i+len_value]
-            if sub_list == value:
+            if value == sub_list:
                 return True
         return False
 
     def __repr__(self):
         return pprint.pformat(list(self))
 
+    def __eq__(self, other):
+        self_list = list(self)
+        other_list = list(other)
+        # checking equality both directions is necessary for ANY to work
+        return self_list == other_list or other_list == self_list
+
 
 def _check_and_set_parent(parent, value, name, new_name):
     # function passed to create_autospec will have mock