[Python-Dev] Unittest/doctest formatting differences in 2.7a1?

R. David Murray rdmurray at bitdance.com
Wed Dec 9 18:52:22 CET 2009

On Wed, 09 Dec 2009 18:23:11 +0100, Lennart Regebro wrote:
> If the exception format has changed, I consider it a bug. Possibly a
> bug in doctest, as the only way to test for exceptions in that case is
> like this:
>     >>> try:
>     ...     throw_an_exception()
>     ...     print "Did not throw the exception"
>     ... except DesiredException:
>     ...     print "passed"
>     passed
> And that frankly is rather ugly. That's how I have done with doctests
> when porting to Python 3 so far. I don't think it's a good idea to
> require it for Python 2.7 as well.

If it's a bug it would have to be in doctest, since the format of
traceback messages is explicitly *not* part of the Python API.

In what way is the doctest ellipsis support not sufficient for this

--David (RDM)

More information about the Python-Dev mailing list