Skip to content

Commit

Permalink
bpo-37555: Replacing __eq__ with == to sidestep NotImplemented
Browse files Browse the repository at this point in the history
bool(NotImplemented) returns True, so it's necessary to use ==
instead of __eq__ in this comparison.
  • Loading branch information
ElizabethU committed Jul 20, 2019
1 parent f0e8411 commit f295eac
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Lib/unittest/mock.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ 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)
return self_list == other_list or other_list == self_list


def _check_and_set_parent(parent, value, name, new_name):
Expand Down Expand Up @@ -2411,8 +2411,8 @@ def __eq__(self, other):
self_params = self_args, self_kwargs
other_params = other_args, other_kwargs
return (
self_params.__eq__(other_params)
or other_params.__eq__(self_params)
self_params == other_params
or other_params == self_params
)


Expand Down

0 comments on commit f295eac

Please sign in to comment.