doctest redundant mock class instantiations

Marc 'BlackJack' Rintsch bj_666 at gmx.net
Sat Oct 25 02:50:22 EDT 2008


On Sat, 25 Oct 2008 03:29:39 +0000, Steven D'Aprano wrote:

> Personally, I tend to use a combination of approaches. Since doctests
> aren't intended for full test coverage, I use *short* tests in methods.
> If I can't make a test short, it doesn't go into the method doctest. For
> more extensive tests, I put them into the class or even module doctest.

IMHO doctests in docstrings are not for testing the code but for testing 
usage examples in the docstrings.  So I don't write *tests* there, but 
useful examples for the programmer who might have to use that functions 
or methods and use the doctest module to check if my examples agree with 
the actual implementation.

Ciao,
	Marc 'BlackJack' Rintsch



More information about the Python-list mailing list