diff options
Diffstat (limited to 'Lib/doctest.py')
-rw-r--r-- | Lib/doctest.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/doctest.py b/Lib/doctest.py index 2f14aa0..d109b6c 100644 --- a/Lib/doctest.py +++ b/Lib/doctest.py @@ -591,9 +591,11 @@ class DocTest: def __lt__(self, other): if not isinstance(other, DocTest): return NotImplemented - return ((self.name, self.filename, self.lineno, id(self)) + self_lno = self.lineno if self.lineno is not None else -1 + other_lno = other.lineno if other.lineno is not None else -1 + return ((self.name, self.filename, self_lno, id(self)) < - (other.name, other.filename, other.lineno, id(other))) + (other.name, other.filename, other_lno, id(other))) ###################################################################### ## 3. DocTestParser |