diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2009-07-08 09:24:20 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2009-07-08 09:24:20 -0400 |
commit | cf8104fc6f89f930c9ed73aa5fcb26d719c34c8c (patch) | |
tree | 09a17673d425ae0333e78e64f28ca927a5fcb958 /coverage/codeunit.py | |
parent | 7543acc020bcf956c95396b234b26f0b26783243 (diff) | |
download | python-coveragepy-cf8104fc6f89f930c9ed73aa5fcb26d719c34c8c.tar.gz |
Various Py3k fixes: remove gratuitous print, don't test the print statement, deal with __cmp__ ugliness, etc.
Diffstat (limited to 'coverage/codeunit.py')
-rw-r--r-- | coverage/codeunit.py | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/coverage/codeunit.py b/coverage/codeunit.py index 87782cd..7f4ed96 100644 --- a/coverage/codeunit.py +++ b/coverage/codeunit.py @@ -83,8 +83,26 @@ class CodeUnit: def __repr__(self): return "<CodeUnit name=%r filename=%r>" % (self.name, self.filename) - def __cmp__(self, other): - return cmp(self.name, other.name) + # Annoying comparison operators. Py3k wants __lt__ etc, and Py2k needs all + # of them defined. + + def __lt__(self, other): + return self.name < other.name + + def __le__(self, other): + return self.name <= other.name + + def __eq__(self, other): + return self.name == other.name + + def __ne__(self, other): + return self.name != other.name + + def __gt__(self, other): + return self.name > other.name + + def __ge__(self, other): + return self.name >= other.name def flat_rootname(self): """A base for a flat filename to correspond to this code unit. |