mirror of
https://github.com/python/cpython.git
synced 2025-12-05 00:52:25 +00:00
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.
This commit is contained in:
parent
79f5543685
commit
e0192e576f
1 changed files with 10 additions and 6 deletions
|
|
@ -325,7 +325,7 @@ continuation lines, then `DocTest` will raise a ValueError:
|
||||||
... '''
|
... '''
|
||||||
>>> parser.get_doctest(docstring, globs, 'some_test', 'filename', 0)
|
>>> parser.get_doctest(docstring, globs, 'some_test', 'filename', 0)
|
||||||
Traceback (most recent call last):
|
Traceback (most recent call last):
|
||||||
ValueError: line 2 of the docstring for some_test has inconsistent leading whitespace: '... 2)'
|
ValueError: line 2 of the docstring for some_test has inconsistent leading whitespace: '... 2))'
|
||||||
|
|
||||||
If there's no blank space after a PS1 prompt ('>>>'), then `DocTest`
|
If there's no blank space after a PS1 prompt ('>>>'), then `DocTest`
|
||||||
will raise a ValueError:
|
will raise a ValueError:
|
||||||
|
|
@ -1028,14 +1028,18 @@ output to match any substring in the actual output:
|
||||||
|
|
||||||
... also matches nothing:
|
... also matches nothing:
|
||||||
|
|
||||||
>>> for i in range(100):
|
>>> if 1:
|
||||||
... print(i**2, end=' ') #doctest: +ELLIPSIS
|
... for i in range(100):
|
||||||
0 1...4...9 16 ... 36 49 64 ... 9801
|
... print(i**2, end=' ') #doctest: +ELLIPSIS
|
||||||
|
... print('!')
|
||||||
|
0 1...4...9 16 ... 36 49 64 ... 9801 !
|
||||||
|
|
||||||
... can be surprising; e.g., this test passes:
|
... can be surprising; e.g., this test passes:
|
||||||
|
|
||||||
>>> for i in range(21): #doctest: +ELLIPSIS
|
>>> if 1: #doctest: +ELLIPSIS
|
||||||
... print(i, end=' ')
|
... for i in range(20):
|
||||||
|
... print(i, end=' ')
|
||||||
|
... print(20)
|
||||||
0 1 2 ...1...2...0
|
0 1 2 ...1...2...0
|
||||||
|
|
||||||
Examples from the docs:
|
Examples from the docs:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue