[Numpy-discussion] Proposal for matrix_rank function in numpy
Charles R Harris
Fri Dec 18 21:46:26 CST 2009
On Fri, Dec 18, 2009 at 8:21 PM, Fernando Perez <email@example.com>wrote:
> On Wed, Dec 16, 2009 at 10:56 AM, Skipper Seabold <firstname.lastname@example.org>
> > 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...
I don't think there is a policy, but there is a growing tradition to put
"serious" tests in a test suite and avoid making them doctests. Functional
tests need to be easy to read, maintain, and document, and doctests don't
really fit that description. Your policy for examples in docstrings looks
like a good one, though.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion