Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e0192e5

Browse files
committed
Fix the remaining doctest failures.
One was a modified line that was echoed in an exception; the other two were softspace problems, fixed clumsily but effectively.
1 parent 79f5543 commit e0192e5

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

Lib/test/test_doctest.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ def test_DocTest(): r"""
325325
... '''
326326
>>> parser.get_doctest(docstring, globs, 'some_test', 'filename', 0)
327327
Traceback (most recent call last):
328-
ValueError: line 2 of the docstring for some_test has inconsistent leading whitespace: '... 2)'
328+
ValueError: line 2 of the docstring for some_test has inconsistent leading whitespace: '... 2))'
329329
330330
If there's no blank space after a PS1 prompt ('>>>'), then `DocTest`
331331
will raise a ValueError:
@@ -1028,14 +1028,18 @@ def optionflags(): r"""
10281028
10291029
... also matches nothing:
10301030
1031-
>>> for i in range(100):
1032-
... print(i**2, end=' ') #doctest: +ELLIPSIS
1033-
0 1...4...9 16 ... 36 49 64 ... 9801
1031+
>>> if 1:
1032+
... for i in range(100):
1033+
... print(i**2, end=' ') #doctest: +ELLIPSIS
1034+
... print('!')
1035+
0 1...4...9 16 ... 36 49 64 ... 9801 !
10341036
10351037
... can be surprising; e.g., this test passes:
10361038
1037-
>>> for i in range(21): #doctest: +ELLIPSIS
1038-
... print(i, end=' ')
1039+
>>> if 1: #doctest: +ELLIPSIS
1040+
... for i in range(20):
1041+
... print(i, end=' ')
1042+
... print(20)
10391043
0 1 2 ...1...2...0
10401044
10411045
Examples from the docs:

0 commit comments

Comments
 (0)