[Python-checkins] CVS: python/dist/src/Lib doctest.py,NONE,1.1
Tim Peters
tim_one@users.sourceforge.net
Mon, 15 Jan 2001 23:10:59 -0800
Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv18717/python/dist/src/lib
Added Files:
doctest.py
Log Message:
doctest-- The Little Module That Could --finally makes it to the Big Show <wink>.
--- NEW FILE: doctest.py ---
# Module doctest version 0.9.6
# Released to the public domain 16-Jan-2001,
# by Tim Peters (tim.one@home.com).
# Provided as-is; use at your own risk; no warranty; no promises; enjoy!
"""Module doctest -- a framework for running examples in docstrings.
NORMAL USAGE
In normal use, end each module M with:
def _test():
import doctest, M # replace M with your module's name
return doctest.testmod(M) # ditto
if __name__ == "__main__":
_test()
[...1062 lines suppressed...]
-42
"""
return self.val
__test__ = {"_TestClass": _TestClass,
"string": r"""
Example of a string object, searched as-is.
>>> x = 1; y = 2
>>> x + y, x * y
(3, 2)
"""
}
def _test():
import doctest
return doctest.testmod(doctest)
if __name__ == "__main__":
_test()