From cf8104fc6f89f930c9ed73aa5fcb26d719c34c8c Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Wed, 8 Jul 2009 09:24:20 -0400 Subject: Various Py3k fixes: remove gratuitous print, don't test the print statement, deal with __cmp__ ugliness, etc. --- coverage/codeunit.py | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'coverage/codeunit.py') 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 "" % (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. -- cgit v1.2.1