mirror of
https://github.com/python/cpython.git
synced 2025-07-09 20:35:26 +00:00
gh-94722: fix DocTest.__eq__ for case of no line number on one side (#112385)
This commit is contained in:
parent
19a1fc1b3d
commit
fbb9027a03
3 changed files with 23 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue