[Python-checkins] python/dist/src/Doc/lib libdoctest.tex,1.12,1.13

rhettinger@users.sourceforge.net rhettinger@users.sourceforge.net
2003年7月11日 15:32:20 -0700


Update of /cvsroot/python/python/dist/src/Doc/lib
In directory sc8-pr-cvs1:/tmp/cvs-serv655
Modified Files:
	libdoctest.tex 
Log Message:
Document Jim Fulton's docttest extensions.
Index: libdoctest.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/lib/libdoctest.tex,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** libdoctest.tex	28 Jun 2003 03:09:06 -0000	1.12
--- libdoctest.tex	11 Jul 2003 22:32:18 -0000	1.13
***************
*** 66,70 ****
 if math.floor(n) != n:
 raise ValueError("n must be exact integer")
! if n+1 == n: # e.g., 1e300
 raise OverflowError("n too large")
 result = 1
--- 66,70 ----
 if math.floor(n) != n:
 raise ValueError("n must be exact integer")
! if n+1 == n: # catch a value like 1e300
 raise OverflowError("n too large")
 result = 1
***************
*** 244,254 ****
 \subsection{Advanced Usage}
 
! \function{testmod()} actually creates a local instance of class
! \class{Tester}, runs appropriate methods of that class, and merges
! the results into global \class{Tester} instance \code{master}.
 
! You can create your own instances of \class{Tester}, and so build your
! own policies, or even run methods of \code{master} directly. See
! \code{Tester.__doc__} for details.
 
 
--- 244,316 ----
 \subsection{Advanced Usage}
 
! Several module level functions are available for controlling how doctests
! are run.
 
! \begin{funcdesc}{debug}{module, name}
! Debug a single docstring containing doctests.
! 
! Provide the \var{module} (or dotted name of the module) containing the
! docstring to be debugged and the \var{name} (within the module) of the
! object with the docstring to be debugged.
! 
! The doctest examples are extracted (see function \function{testsource()}),
! and written to a temporary file. The Python debugger, \refmodule{pdb},
! is then invoked on that file. 
! \versionadded{2.3}
! \end{funcdesc}
! 
! \begin{funcdesc}{testmod}{}
! This function provides the most basic interface to the doctests.
! It creates a local instance of class \class{Tester}, runs appropriate
! methods of that class, and merges the results into the global \class{Tester}
! instance, \code{master}.
! 
! To get finer control than \function{testmod()} offers, create an instance
! of \class{Tester} with custom policies and run the methods of \code{master}
! directly. See \code{Tester.__doc__} for details.
! \end{funcdesc}
! 
! \begin{funcdesc}{testsource}{module, name}
! Extract the doctest examples from a docstring.
! 
! Provide the \var{module} (or dotted name of the module) containing the
! tests to be extracted and the \var{name} (within the module) of the object
! with the docstring containing the tests to be extracted.
! 
! The doctest examples are returned as a string containing Python
! code. The expected output blocks in the examples are converted
! to Python comments.
! \versionadded{2.3}
! \end{funcdesc}
! 
! \begin{funcdesc}{DocTestSuite}{\optional{module}}
! Convert doctest tests for a module to a \refmodule{unittest}
! \class{TestSuite}.
! 
! The returned \class{TestSuite} is to be run by the unittest framework
! and runs each doctest in the module. If any of the doctests fail,
! then the synthesized unit test fails, and a \exception{DocTestTestFailure}
! exception is raised showing the name of the file containing the test and a
! (sometimes approximate) line number.
! 
! The optional \var{module} argument provides the module to be tested. It
! can be a module object or a (possibly dotted) module name. If not
! specified, the module calling \function{DocTestSuite()} is used.
! 
! Example using one of the many ways that the \refmodule{unittest} module
! can use a \class{TestSuite}:
! 
! \begin{verbatim}
! import unittest
! import doctest
! import my_module_with_doctests
! 
! suite = doctest.DocTestSuite(my_module_with_doctests)
! runner = unittest.TextTestRunner()
! runner.run(suite)
! \end{verbatim}
! 
! \versionadded{2.3}
! \end{funcdesc}
 
 

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