Skip to content

Commit a96b838

Browse files
author
Mike Dirolf
committed
add a __ne__ implementation wherever we define __eq__
1 parent ec22172 commit a96b838

File tree

5 files changed

+15
-0
lines changed

5 files changed

+15
-0
lines changed

pymongo/binary.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,5 +105,8 @@ def __eq__(self, other):
105105
# subclass of str...
106106
return False
107107

108+
def __ne__(self, other):
109+
return not self == other
110+
108111
def __repr__(self):
109112
return "Binary(%s, %s)" % (str.__repr__(self), self.__subtype)

pymongo/code.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,6 @@ def __eq__(self, other):
5959
if isinstance(other, Code):
6060
return (self.__scope, str(self)) == (other.__scope, str(other))
6161
return False
62+
63+
def __ne__(self, other):
64+
return not self == other

pymongo/max_key.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,8 @@ def __eq__(self, other):
2525
return True
2626
return NotImplemented
2727

28+
def __ne__(self, other):
29+
return not self == other
30+
2831
def __repr__(self):
2932
return "MaxKey()"

pymongo/min_key.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,8 @@ def __eq__(self, other):
2525
return True
2626
return NotImplemented
2727

28+
def __ne__(self, other):
29+
return not self == other
30+
2831
def __repr__(self):
2932
return "MinKey()"

pymongo/timestamp.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ def __eq__(self, other):
8080
else:
8181
return NotImplemented
8282

83+
def __ne__(self, other):
84+
return not self == other
85+
8386
def __repr__(self):
8487
return "Timestamp(%s, %s)" % (self.__time, self.__inc)
8588

0 commit comments

Comments
 (0)