On Dec 8, 2006, at 10:32 AM, Alan G Isaac wrote:
On Fri, 8 Dec 2006, Jonathan Guyer apparently wrote:
doctests (including our full example scripts) cover all the things our old unittest suites did, and a great deal more, and they're a lot easier to write, read, and maintain.
Would you agree with the assessment here (at the bottom): http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/305292 ?
By and large, yes. I'm aware of the arguments that unit tests should be separate from code, but I'm not really persuaded by that in practice. I think it's much more likely that separate tests will be completely out of date and irrelevant (whether or not they pass). As far as
A potential problem with doctest is that you may have so many tests that your docstrings would hinder rather than help understanding of your code we do have a few cases of very pedantic testing that don't serve much use as documentation. For those, we put them in hidden _test* functions at the end of the code. They don't appear in our documentation, but they do get exercised. Putting them in a separate file would be OK, too.