doctest

Thomas Heller theller at python.net
Tue Mar 30 14:47:03 EST 2004


I've just read the 'Automating testing with doctest' pycon paper, and I'm
exited about the future of doctest.

This simple script reads the ctypes docs written in StructuredText, and
runs and tests the code examples in it:

"""
import doctest

ex = doctest._extract_examples(file("tutorial.stx").read())
doctest._run_examples(ex, {}, 0, "tutorial.stx", 0, 0)
"""

Do I understand correctly that the doctest-pretty printer will
eventually remove the remaining 'warts', ie that doctest complains about
the address part in this? And is it already available somewhere?

>>> class X(object): pass
...
>>> x = X()
>>> x
>>> <__main__.X object at 0x008FA3F0>

Thomas





More information about the Python-list mailing list