homepage

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 endolith
Recipients endolith, jedie, rhettinger, tarek
Date 2014年08月30日.03:20:26
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1409368826.95.0.796997200929.issue3332@psf.upfronthosting.co.za>
In-reply-to
Content
The fundamental purpose of doctest is to test that examples in documentation work correctly:
> To check that a module’s docstrings are up-to-date by verifying that all interactive examples still work as documented.
> To perform regression testing by verifying that interactive examples from a test file or a test object work as expected.
> To write tutorial documentation for a package, liberally illustrated with input-output examples. Depending on whether the examples or the expository text are emphasized, this has the flavor of "literate testing" or "executable documentation".
https://docs.python.org/2/library/doctest.html
(and this is not at all the purpose of the unittest module)
If a function returns a set, and the normal way to use it is to call the function and get a set, then the example should be to call the function and get a set:
>>> function()
set([1, 2, 3])
Doctest should therefore be able to test that the example actually works and returns the correct set, regardless of how the set elements are displayed. It should not be required to add unusual extra code to format the output specifically so that doctest can understand it:
>>> function() == set([1, 2, 3])
True
(This is not a realistic example, because the user wouldn't know what the output is until they call the function.)
>>> sorted(function())
[1, 2, 3]
(This is not how the method is actually used in reality. It returns a set for a reason, not a list.)
History
Date User Action Args
2014年08月30日 03:20:27endolithsetrecipients: + endolith, rhettinger, jedie, tarek
2014年08月30日 03:20:26endolithsetmessageid: <1409368826.95.0.796997200929.issue3332@psf.upfronthosting.co.za>
2014年08月30日 03:20:26endolithlinkissue3332 messages
2014年08月30日 03:20:26endolithcreate

AltStyle によって変換されたページ (->オリジナル) /