Message340652
Here is warn.py, a minimal no-dependency repro script:
```
import doctest
class Tester:
r"""Provide docstring for testing.
>>> import warnings
>>> from contextlib import redirect_stderr
>>> from io import StringIO
>>> sio = StringIO()
>>> with redirect_stderr(sio):
... warnings.warn("Warning 'containing' single quotes")
>>> sio.getvalue()
"...UserWarning: Warning 'containing' single quotes\n..."
"""
doctest.run_docstring_examples(
Tester(),
{},
optionflags=doctest.ELLIPSIS,
)
```
`python3.7 warn.py` (3.7.3) gives no output.
`python3.8 warn.py` (3.8.0a3) gives:
```
$ python3.8 warn.py
****************************************************************
File "warn.py", line ?, in NoName
Failed example:
sio.getvalue()
Expected:
"...UserWarning: Warning 'containing' single quotes\n..."
Got:
'<doctest NoName[4]>:2: UserWarning: Warning \'containing\' single quotes\n warnings.warn("Warning \'containing\' single quotes")\n'
```
The problem appears to be centered around *doctest*, as the following script DOES NOT raise AssertionError with either of 3.7 or 3.8:
```
import warnings
from contextlib import redirect_stderr
from io import StringIO
sio = StringIO()
with redirect_stderr(sio):
warnings.warn("Warning 'containing' single quotes")
assert " 'containing' " in sio.getvalue()
``` |
|
Date |
User |
Action |
Args |
2019-04-22 13:52:59 | bskinn | set | recipients:
+ bskinn, brett.cannon, vstinner, takluyver, xtreak |
2019-04-22 13:52:59 | bskinn | set | messageid: <1555941179.62.0.311102619245.issue36695@roundup.psfhosted.org> |
2019-04-22 13:52:59 | bskinn | link | issue36695 messages |
2019-04-22 13:52:59 | bskinn | create | |
|