diff options
author | Benjamin Peterson <benjamin@python.org> | 2008-10-16 19:34:46 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2008-10-16 19:34:46 (GMT) |
commit | 60192084c405292f874d886eed05ed83614d20c4 (patch) | |
tree | 390e2ac0930a866fb1a97d35b469109f09df3ecc /Lib/test/test_long.py | |
parent | aaebe1c11d0eccc067cb6e5bb4e28543441fd2df (diff) | |
download | cpython-60192084c405292f874d886eed05ed83614d20c4.zip cpython-60192084c405292f874d886eed05ed83614d20c4.tar.gz cpython-60192084c405292f874d886eed05ed83614d20c4.tar.bz2 |
remove some more references to __cmp__ #1717
Diffstat (limited to 'Lib/test/test_long.py')
-rw-r--r-- | Lib/test/test_long.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/Lib/test/test_long.py b/Lib/test/test_long.py index dc04bad..a1db26a 100644 --- a/Lib/test/test_long.py +++ b/Lib/test/test_long.py @@ -669,10 +669,22 @@ class LongTest(unittest.TestCase): else: raise TypeError("can't deal with %r" % val) - def __cmp__(self, other): + def _cmp__(self, other): if not isinstance(other, Rat): other = Rat(other) return cmp(self.n * other.d, self.d * other.n) + def __eq__(self, other): + return self._cmp__(other) == 0 + def __ne__(self, other): + return self._cmp__(other) != 0 + def __ge__(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 __lt__(self, other): + return self._cmp__(other) < 0 cases = [0, 0.001, 0.99, 1.0, 1.5, 1e20, 1e200] # 2**48 is an important boundary in the internals. 2**53 is an |