[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Testing Python modules (was Re: Numpy API change?)



On Jul 30, 2010, at 11:16 AM, Nicolas Chauvat wrote:

>On Thu, Jul 29, 2010 at 11:23:05AM -0400, Barry Warsaw wrote:
>> True.  I like separating my tests into submodules, and I don't
>> personally like in-docstring doctests, so I'm biased toward those
>> decisions.
>
>I'd say in-docstring doctests are good at documentation rather than
>extensive testing.

Well, *doctests* in general should always be considered documentation first
(IMHO).  They're testable documentation sure, but testing is not their primary
function in life.

We've had lots of debates among developers about the pros and cons of
doctests, but my own personal feeling is that separate-file doctests can be
excellent at providing system documentation (that can be the source of
generated formats via great tools like Sphinx), and can provide wide - but not
total - system coverage.  IOW, doctests are documentation and are a complement
to traditional Python unittests, not a replacement.  I might differ with other
developers on where to draw the line between doctests and unittests, but
that's all minutia. ;)

I don't personally like in-docstring doctests much.  I find that more compact
and stylized API documentation better in that precious spot (e.g. epydoc style
markup).  Again, I think there is lots of room for different opinions!

Cheers,
-Barry

Attachment: signature.asc
Description: PGP signature


Reply to: