[Zope3-dev] Re: [Zope-Checkins] CVS: Zope3/src/persistent/tests - test_persistent.py:1.5 persistent.txt:1.2

Jim Fulton jim at zope.com
Fri Mar 5 06:14:58 EST 2004


Chris Withers wrote:
> Jeremy Hylton wrote:
> 
>> There was no decision made.  It's just an experiment I tried.  I don't
>> think it's helpful to label the two approachs doctests and real tests,
>> by the way.  A doctest is a real test; it just has a different set of
>> baggage that tests written using unittest.
> 
> 
> A doctest is a lump of text. A real text is a lump of python.

doctest tests are text with Python examples.

..


>>> Personally, I think the doctests below are in danger of looking butt 
>>> ugly :-S
>>
>>
>> Personally, I find them easier to understand than any of the other tests
>> we have.
> 
> 
> Not documenting tests is sloppy coding, which is I think the problem 
> you're trying to solve with doctests... however, you can fail to 
> document doctests just as easily...

Yup. But out experience has been that it is much easier and thus
morel likely to write well-documented tests in doctest than with the
straight unittest framework.  For example, unitest makes it easier to
write python code than to write words. Doctest makes it easier to
write words than code.

Also, the assertions made in doctest are usually more readable.

I'm writing a paper on this for PyCon, which will be available on line.

Jim

-- 
Jim Fulton           mailto:jim at zope.com       Python Powered!
CTO                  (540) 361-1714            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org




More information about the Zope3-dev mailing list