mirror of
https://github.com/python/cpython.git
synced 2025-11-02 03:01:58 +00:00
Example.__init__: this cannot use assert, because that fails to trigger
in a -O run, and so test_doctest was failing under -O. Simple cause, simple cure.
This commit is contained in:
parent
8485b56216
commit
9b625d3037
2 changed files with 8 additions and 5 deletions
|
|
@ -132,13 +132,13 @@ than one line:
|
|||
>>> e = doctest.Example('print 1', '1\n', 0)
|
||||
>>> e = doctest.Example('print 1\n', '1\n', 0)
|
||||
Traceback (most recent call last):
|
||||
AssertionError
|
||||
AssertionError: source must end with newline iff source contains more than one line
|
||||
|
||||
>>> # Source spans multiple lines: require terminating newline.
|
||||
>>> e = doctest.Example('print 1;\nprint 2\n', '1\n2\n', 0)
|
||||
>>> e = doctest.Example('print 1;\nprint 2', '1\n2\n', 0)
|
||||
Traceback (most recent call last):
|
||||
AssertionError
|
||||
AssertionError: source must end with newline iff source contains more than one line
|
||||
|
||||
The `want` string should be terminated by a newline, unless it's the
|
||||
empty string:
|
||||
|
|
@ -146,7 +146,7 @@ empty string:
|
|||
>>> e = doctest.Example('print 1', '1\n', 0)
|
||||
>>> e = doctest.Example('print 1', '1', 0)
|
||||
Traceback (most recent call last):
|
||||
AssertionError
|
||||
AssertionError: non-empty want must end with newline
|
||||
>>> e = doctest.Example('print', '', 0)
|
||||
"""
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue