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 <rep...@bugs.python.org>
<http://bugs.python.org/issue21183>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to