Revert "bpo-37555: Fix _CallList and _Call order sensitivity"

This reverts commit 874fb697b8.
This commit is contained in:
Elizabeth Uselton 2019-07-21 18:45:50 -07:00
parent 344ef173c0
commit bdf430de39

View file

@ -337,19 +337,13 @@ class _CallList(list):
for i in range(0, len_self - len_value + 1):
sub_list = self[i:i+len_value]
if value == sub_list:
if sub_list == value:
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.__eq__(other_list) or other_list.__eq__(self_list)
def _check_and_set_parent(parent, value, name, new_name):
# function passed to create_autospec will have mock
@ -2300,6 +2294,7 @@ def _format_call_signature(name, args, kwargs):
return message % formatted_args
class _Call(tuple):
"""
A tuple for holding the results of a call to a mock, either in the form
@ -2409,12 +2404,8 @@ class _Call(tuple):
if self_name and other_name != self_name:
return False
self_params = self_args, self_kwargs
other_params = other_args, other_kwargs
return (
self_params.__eq__(other_params)
or other_params.__eq__(self_params)
)
# this order is important for ANY to work!
return (other_args, other_kwargs) == (self_args, self_kwargs)
__ne__ = object.__ne__