Commit c834a291 authored by Marius Gedminas's avatar Marius Gedminas

Fix ConflictResolution tests

Python 3 really wants rich comparison operators
parent 631bf4ed
......@@ -183,13 +183,32 @@ class PersistentReference(object):
"can't reliably compare against different "
"PersistentReferences")
# Python 3 dropped __cmp__
def __eq__(self, other):
return self.__cmp__(other) == 0
def __ne__(self, other):
return self.__cmp__(other) != 0
def __lt__(self, other):
return self.__cmp__(other) < 0
def __gt__(self, other):
return self.__cmp__(other) > 0
def __le__(self, other):
return self.__cmp__(other) <= 0
def __ge__(self, other):
return self.__cmp__(other) >= 0
def __repr__(self):
return "PR(%s %s)" % (id(self), self.data)
def __getstate__(self):
raise PicklingError("Can't pickle PersistentReference")
@property
def klass(self):
# for tests
......
......@@ -66,9 +66,11 @@ use:
class PCounter(Persistent):
'`value` is readonly; increment it with `inc`.'
# Fool BTree checks for sane comparison :/
def __cmp__(self, other):
'Fool BTree checks for sane comparison :/'
return object.__cmp__(self, other)
def __lt__(self, other):
return object.__lt__(self, other)
_val = 0
def inc(self):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment