[Python-ideas] Fwd: doctest

Mark Janssen dreamingforward at gmail.com
Mon Feb 27 20:23:15 CET 2012


I just realized I've been replying personally to these replies instead
of the whole list (damn I hate that!).  So resending a bunch of
messages that went to individuals.  [Mark]
On Fri, Feb 17, 2012 at 3:12 PM, Nick Coghlan <ncoghlan at gmail.com> wrote:
> On Sat, Feb 18, 2012 at 7:57 AM, Mark Janssen <dreamingforward at gmail.com> wrote:
>> Anyway... of course patches welcome, yes...  ;^)
>
> Not really. doctest is for *testing code example in docs*.

I understand.  This is exactly what I was wanting to use it for.  As
Tim says "literate testing" or "executable documentation".

The suggestions I made are for enhancing those two.

Personally, I don't find unittest very suitable for test-driven
*development*, although it *is* obviously well-suited for writing
assurance tests otherwise.

The key difference, to me, is in that doctest promotes tests being
written in order to have the *additional functionality* of
documentation.    That makes it fun since your getting "twice the
value for the cost of one", and that alone is the major item which
drives test-driven development (IMHO) within the spirit of python,
otherwise unittest is rather bulky to write in and of itself.

Does anyone really use unittest outside the context of shop policy?

mark



More information about the Python-ideas mailing list