Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix __eq__ and __ne__. #3765

Merged
merged 5 commits into from
Aug 8, 2017
Merged

Conversation

lukesneeringer
Copy link
Contributor

This updates __eq__ to do type-checking correctly on all classes (except mock classes defined in unit test modules):

def __eq__(self, other):
    if not isinstance(other, type(self)):
        return NotImplemented

It also updates __ne__ to be exactly:

def __ne__(self, other):
    return not self == other

Fixes #3455.

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Aug 8, 2017
return(
self.udf_type == other.udf_type and
self.value == other.value)

def __ne__(self, other):
return not self == other

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

return self._key() != other._key()
else:
return NotImplemented
return not self == other

This comment was marked as spam.

This comment was marked as spam.

@dhermes
Copy link
Contributor

dhermes commented Aug 8, 2017

LGTM

@lukesneeringer lukesneeringer merged commit b242099 into googleapis:master Aug 8, 2017
@lukesneeringer lukesneeringer deleted the issue-3455 branch August 8, 2017 21:51
landrito pushed a commit to landrito/google-cloud-python that referenced this pull request Aug 21, 2017
landrito pushed a commit to landrito/google-cloud-python that referenced this pull request Aug 22, 2017
landrito pushed a commit to landrito/google-cloud-python that referenced this pull request Aug 22, 2017
This was referenced Aug 24, 2017
parthea pushed a commit that referenced this pull request Oct 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants