[Python-checkins] python/dist/src/Lib doctest.py,1.36,1.36.2.1

edloper at users.sourceforge.net edloper at users.sourceforge.net
Tue Aug 3 00:07:15 CEST 2004


Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14877
Modified Files:
 Tag: tim-doctest-branch
	doctest.py 
Log Message:
Reorganization of doctest module, to give a more pluggable architecture:
- Defined 4 new classes:
 - Example: a <source, want> pair, plus an intra-docstring line number.
 - DocTest: a collection of examples, parsed from a docstring, plus
 info about where the docstring came from (name, filename, lineno).
 - DocTestFinder: extracts DocTests from a given object's docstring and
 its contained objects' docstrings.
 - DocTestRunner: runs DocTest cases, and accumulates statistics.
- Removed code duplication
- Redefined Tester, testmod(), and run_docstring_examples(), to use the
 4 new classes
- Added several new options for comparison & output
- When looking for objects to test, don't explore the same object twice
- Better exception handling: handle output that occurs before the
 exception, and handle multi-line exception messages.
- Support for running tests on text files
Note: the debugging code is currently broken.
Index: doctest.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/doctest.py,v
retrieving revision 1.36
retrieving revision 1.36.2.1
diff -C2 -d -r1.36 -r1.36.2.1
*** doctest.py	14 Jul 2004 19:06:50 -0000	1.36
--- doctest.py	2 Aug 2004 22:07:11 -0000	1.36.2.1
***************
*** 5,8 ****
--- 5,9 ----
 # Provided as-is; use at your own risk; no warranty; no promises; enjoy!
 
+ # [XX] This docstring is out-of-date:
 r"""Module doctest -- a framework for running examples in docstrings.
 
***************
*** 286,564 ****
 
 __all__ = [
[...2508 lines suppressed...]
+ x
+ Traceback (most recent call last):
+ [...]
+ ValueError: 
+ foo
+ 
+ """
+ 
+ def _test():
+ #import doctest
+ #doctest.testmod(doctest, verbose=False,
+ # optionflags=ELLIPSIS | NORMALIZE_WHITESPACE |
+ # UNIFIED_DIFF)
+ #print '~'*70
+ r = unittest.TextTestRunner()
+ r.run(DocTestSuite())#optionflags=ELLIPSIS | NORMALIZE_WHITESPACE |
+ # UNIFIED_DIFF))
+ 
 if __name__ == "__main__":
 _test()


More information about the Python-checkins mailing list

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