This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author JDLH
Recipients JDLH, docs@python, marco.buttu, r.david.murray
Date 2017-02-04.21:02:37
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <[email protected]>
In-reply-to
Content
Marco, thank you for the suggestion of a howto. That is a good idea. 

In parallel, I was thinking of some howto content that I would like to see documented. 

• How to decide what to test with doctests and what with unittests. I have a feeling that the sweet spot of doctests is functionality which you can invoke in one line, and which produces one line of output which you can match against a reference string. If it takes many lines to set up, or invoke, or checking for correctness is more than a test for string equality, then maybe unittest is a better tool.

• An effective way to write doctests. I suspect that some people write doctests by exercising the functionality in Python's interactive mode, then copy and paste the transcript from that session to the doctests. I don't do it that way, I author in the docstring. Maybe I'm not doing it the best way.

• How to author doctests so that they both prove the module correct, and provide clear and readable documentation. I imagine some effective tests for edge cases and error conditions are important to have, but are not readable documentation. Maybe such tests belong in a unittest framework instead of as doctests.

• How to run doctests from a unittest harness (your earlier note about the unittest API would be a part of this).

A problem for me is that I think I don't have the experience and wisdom to give good advice in these areas. I would be happy to start such a howto, and to accept feedback, and to edit it into good prose. I would need wiser people to contribute good ideas for the howto.

Also, Marco, thank you for being willing to review a patch.  That is helpful.

My next step is to check out the documentation source, to be in a position to make a patch.
History
Date User Action Args
2017-02-04 21:02:37JDLHsetrecipients: + JDLH, r.david.murray, docs@python, marco.buttu
2017-02-04 21:02:37JDLHsetmessageid: <[email protected]>
2017-02-04 21:02:37JDLHlinkissue29428 messages
2017-02-04 21:02:37JDLHcreate