[Numpy-discussion] Proposal for matrix_rank function in numpy

Fernando Perez fperez.net at gmail.com
Fri Dec 18 22:21:47 EST 2009


On Wed, Dec 16, 2009 at 10:56 AM, Skipper Seabold <jsseabold at gmail.com> wrote:
> Presumably the doctests should be turned into
> actual tests (noting Robert's comment) to make it more likely that it
> gets in

Just curious: is there a policy against pure doctests in numpy? I've
always found that doctests and 'real tests' serve complementary
purposes and are both useful:

- small, clear tests that make for *illustrative* examples for the end
user should be left in the docstring, and picked up by the test suite
as normal doctests.

- tests with a lot more logic that get cumbersome to write as doctests
can go into 'normal' tests into the test suite.

- There's also a valid third category: for cases where it's convenient
to write the test interactively but one doesn't want the example in
the main docstring, putting a function in the test suite that simply
has the doctest as a docstring works (it may require a little
decorator, I don't recall).

I'm just wondering if there's a policy of requiring that all tests
become non-doctests...

Cheers,

f



More information about the NumPy-Discussion mailing list