4 ms·
The exception that proves the rule. I think the Python community is, to a certain degree, split on the usefulness of doctests, and in my experience most devs se
by ubercore 16y ago
The exception that proves the rule. I think the Python community is, to a certain degree, split on the usefulness of doctests, and in my experience most devs see them as useful documentation first, and tests second.
- jedsmith 16y agoI use unittest (and the 2.7 features backported in unittest2) unconditionally over doctest. I don't think I'm alone there, as most of the Python devs I know do the same thing. The learned skill of unit testing the Java way carried over nicely.
- rbanffy 16y agoDoctests make very useful, always up-to-date and tested, documentation.
- SoftwareMaven 16y agoI don't understand why this was down-voted. IMO, the primary value of doctests is in having example code that you know actually works and being forced to change the example if the implementation changes. On the other hand, unittest is far cleaner for testing corner cases and the like. I've used both in a project quite happily (and like that Django has default support for both).