summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_doctest.py
diff options
context:
space:
mode:
authorIrit Katriel <1055913+iritkatriel@users.noreply.github.com>2023-11-25 17:23:43 (GMT)
committerGitHub <noreply@github.com>2023-11-25 17:23:43 (GMT)
commitfbb9027a037ff1bfaf3f596df033ca45743ee980 (patch)
tree3185087b2f2589a7e9ca05def92bafa5c3c30320 /Lib/test/test_doctest.py
parent19a1fc1b3df30f64450d157dc3a5d40c992e347f (diff)
downloadcpython-fbb9027a037ff1bfaf3f596df033ca45743ee980.zip
cpython-fbb9027a037ff1bfaf3f596df033ca45743ee980.tar.gz
cpython-fbb9027a037ff1bfaf3f596df033ca45743ee980.tar.bz2
gh-94722: fix DocTest.__eq__ for case of no line number on one side (#112385)
Diffstat (limited to 'Lib/test/test_doctest.py')
-rw-r--r--Lib/test/test_doctest.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/Lib/test/test_doctest.py b/Lib/test/test_doctest.py
index cb4e215..772dbd1 100644
--- a/Lib/test/test_doctest.py
+++ b/Lib/test/test_doctest.py
@@ -413,6 +413,23 @@ Compare `DocTest`:
False
>>> test != other_test
True
+ >>> test < other_test
+ False
+ >>> other_test < test
+ True
+
+Test comparison with lineno None on one side
+
+ >>> no_lineno = parser.get_doctest(docstring, globs, 'some_test',
+ ... 'some_test', None)
+ >>> test.lineno is None
+ False
+ >>> no_lineno.lineno is None
+ True
+ >>> test < no_lineno
+ False
+ >>> no_lineno < test
+ True
Compare `DocTestCase`: