[issue21183] Doctest capture only AssertionError but not printed text
Osvaldo Santana Neto
report at bugs.python.org
Wed Apr 9 04:13:51 CEST 2014
New submission from Osvaldo Santana Neto:
The following doctest should pass, but it fails:
>>> def spam(): print("eggs")
...
>>> assert spam()
eggs
Traceback (most recent call last):
AssertionError
But if we remove the print output from printed results the test pass:
>>> def spam(): print("eggs")
...
>>> assert spam()
Traceback (most recent call last):
AssertionError
I'm writing the 2nd edition of a book about Python (covering python3) and Django and I'm using doctest to run the interactive sessions that I use as examples in book.
----------
components: Library (Lib)
files: doctest_bug.py
messages: 215796
nosy: osantana
priority: normal
severity: normal
status: open
title: Doctest capture only AssertionError but not printed text
type: behavior
versions: Python 2.7, Python 3.4
Added file: http://bugs.python.org/file34771/doctest_bug.py
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21183>
_______________________________________
More information about the Python-bugs-list
mailing list