[TIP] doctest and floats
Ben Finney
bignose+hates-spam at benfinney.id.au
Tue Mar 11 10:45:50 PDT 2008
Andrew Bennetts <andrew-tip at puzzling.org> writes:
> Decide on what you're writing. If you're writing documentation, make
> it good documentation. If you're writing tests to make sure your
> code works, make it test comprehensively and accurately.
>
> These can be conflicting goals. I don't believe it is always
> possible for great tests to be great documentation. [...]
Agreed.
> So the question might be which is the worse trade-off: having tests
> and documentation combined in a file that does a poor job of
> satisfying both needs, or having two files?
It's not necessarily either-or. One can have those doctests that *are*
good documentation in the docstrings
<URL:http://www.python.org/doc/lib/doctest-simple-testmod.html>, and
those doctests that are not good documentation in a separate file
<URL:http://www.python.org/doc/lib/doctest-simple-testfile.html> to be
loaded and run explicitly.
--
\ "I busted a mirror and got seven years bad luck, but my lawyer |
`\ thinks he can get me five." -- Steven Wright |
_o__) |
Ben Finney
More information about the testing-in-python
mailing list