[Numpy-discussion] Doctest items
Tue Jul 1 13:45:58 CDT 2008
On Tue, Jul 1, 2008 at 12:56, Alan McIntyre <email@example.com> wrote:
> 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.
It seems to me that the ellipsis mechanism just allows the output to
differ. However, matplotlib would still be required because plt.plot()
would still be executed. matplotlib should not be a requirement for
running the tests.
> 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.
Thank you for the notice.
"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
-- Umberto Eco
More information about the Numpy-discussion