ironic doctest bug?

Tim Peters tim.peters at gmail.com
Sun Aug 15 05:28:41 CEST 2004


[Alan G Isaac]
>> 1 items had failures:
>>    1 of  14 in doctest.Tester.rundict
>> 71 tests in 47 items.
>> 70 passed and 1 failed.
>> ***Test Failed*** 1 failures.

> This was the punchline of course.
> Am I overlooking something?

Mostly just this:

   http://www.catb.org/~esr/faqs/smart-questions.html

You didn't say which version of Python, or which OS, and didn't ask a
specific question despite a long original post.  Those points all
conspired to make the post ignorable.

My guess is that you're using some flavor of Python 2.3.  Your
original post contained the only relevant clue:

> python doctest.py -v

If you had run it without -v, my guess is that it would have passed.

Looking at the output with -v identifies the failing test when running
with -v.  That's

       >>> testmod(m1, isprivate=is_private)

in doctest.Tester.rundict's docstring.

Looking at the other tests in the docstring shows that they all add
verbose=0 to their testmod() call, and that this one was unique in not
doing so.  So someone was probably a teensy careless when they added
this test.  Change the test to

       >>> testmod(m1, isprivate=is_private, verbose=0)

so it looks like the others, and then it passes with or without -v.

It's too minor a bug to justify a new Python 2.3 release <wink>.  The
problem doesn't exist in Python CVS, so it won't happen in 2.4.



More information about the Python-list mailing list