[Numpy-discussion] Doctest items

Alan McIntyre alan.mcintyre@gmail....
Tue Jul 1 12:56:45 CDT 2008

Just a few questions/comments about doctests:

1. Should all doctests be written such that you could start Python, do
an "import numpy as np", and then type in the examples verbatim? There
are a number that currently wouldn't work that way (they depend on the
function under test being in the local namespace, for example).

2. In regard to the auto-ignore of "plt.", etc. in commands: using the
existing ellipsis feature of doctest should cover a significant
portion of the cases that the auto-ignore was suggested to solve, and
it's a very minor change to enable it (whereas the auto-ignore is more
involved).  If nobody objects, I will enable ellipsis for all doctests
(which doesn't cause any obvious problems in existing NumPy tests),
and use it to clean up existing doctests where appropriate.  If the
auto-ignore capability is still needed after that, I'll work on it.

3. When the test suite is run with doctests enabled, some unit tests
fail that normally wouldn't, and some doctests fail that shouldn't.
There's probably some state that needs to be reset (or otherwise
managed) between doctest runs; I'll look into that and provide a fix
as soon as possible.  I just figured I should mention it in case it
causes somebody problems before it gets fixed.


More information about the Numpy-discussion mailing list