I hate to add more to this discussion, but I think some folks might have some miss-conceptions about doctests:

On Mar 10, 2008, at 12:39 PM, Tres Seaver wrote:
Becuase they make for poor unit tests?  Using them to document the
"mainline" use cases for an API is one thing: using them to do thorough
coverage of edge cases is quite another. I find that for the latter,
they fail *both* as documentation *and* as tests:  their value as
documentation drops as the amount of scaffoldiing rises, and the lack of isolation between tests sharply reduces their value for testing the corners.

It is certainly straightforward enough to create isolated doctests. For edge cases, I do typically create separate isolated short doctests that deal just with that case. The assertion that doctests don't allow isolation is simply not correct.

I'm not sure what scaffolding you're referring to. Do you mean test set up? Or the tools for normalizing output? For test set up, I don't think there's any difference. I can sympathize with the skepticism with normalizing output. Sometimes, I think it might be better to write documented tests rather than executable documentation and use assertion of a more traditional nature, if the test is still readable, although I suspect that it will often be easier to normalize output rather than make lots of assertions about the output.


Jim Fulton
Zope Corporation

Zope-Dev maillist  -  Zope-Dev@zope.org
**  No cross posts or HTML encoding!  **
(Related lists - http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope )

Reply via email to