Commit f4bfe178 authored by Marius Gedminas's avatar Marius Gedminas

Add __le__ and __ge__

parent f0b26152
......@@ -12,7 +12,6 @@
#
##############################################################################
"""A minimal persistent object to use for tests"""
import functools
from persistent import Persistent
class MinPO(Persistent):
......@@ -23,17 +22,26 @@ class MinPO(Persistent):
return cmp(self.value, aMinPO.value)
# Py3: Python 3 does not support cmp() anymore. This is insane!!
def __eq__(self, aMinPO):
return self.value == aMinPO.value
def __lt__(self, aMinPO):
return self.value < aMinPO.value
# @functools.total_ordering is not available in 2.6 :-(
def __ne__(self, aMinPO):
return self.value != aMinPO.value
def __gt__(self, aMinPO):
return self.value > aMinPO.value
def __lt__(self, aMinPO):
return self.value < aMinPO.value
def __le__(self, aMinPO):
return self.value <= aMinPO.value
def __ge__(self, aMinPO):
return self.value >= aMinPO.value
def __repr__(self):
return "MinPO(%s)" % self.value
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