Skip to content

Commit

Permalink
use __eq__ instead of __cmp__ testing
Browse files Browse the repository at this point in the history
  • Loading branch information
hannosch committed May 5, 2013
1 parent 246f219 commit 561062c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Persistence/tests/test_ec.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ def cmpattrs(self, other, *attrs):
for attr in attrs:
if attr[:3] in ('_v_', '_p_'):
continue
c = cmp(getattr(self, attr, None), getattr(other, attr, None))
c = getattr(self, attr, None) == getattr(other, attr, None)
if c:
return c
return 0
Expand All @@ -222,7 +222,7 @@ def __init__(self, name, **kw):
self._v_favorite_color = 'blue'
self._p_foo = 'bar'

def __cmp__(self, other):
def __eq__(self, other):
return cmpattrs(self, other, '__class__', *(self.__dict__.keys()))


Expand Down Expand Up @@ -323,7 +323,7 @@ def __init__(self, s1, s2, s3):
Slotted.__init__(self, s1, s2)
self.s3 = s3

def __cmp__(self, other):
def __eq__(self, other):
return cmpattrs(self, other, '__class__', 's1', 's2', 's3', 's4')


Expand Down Expand Up @@ -372,7 +372,7 @@ def __init__(self, s1, s2, s3, **kw):
self._v_favorite_color = 'blue'
self._p_foo = 'bar'

def __cmp__(self, other):
def __eq__(self, other):
return cmpattrs(self, other,
'__class__', 's1', 's2', 's3', 's4',
*(self.__dict__.keys()))
Expand Down

0 comments on commit 561062c

Please sign in to comment.