python/dist/src/Doc/lib libunittest.tex, 1.17, 1.18

Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv6085 Modified Files: libunittest.tex Log Message: - add a "See also" reference to the doctest module - slightly simplify a couple of examples - clean up some markup Index: libunittest.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libunittest.tex,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** libunittest.tex 7 Dec 2003 10:48:03 -0000 1.17 --- libunittest.tex 31 Dec 2003 04:34:50 -0000 1.18 *************** *** 83,86 **** --- 83,88 ---- \begin{seealso} + \seemodule{doctest}{Another test-support module with a very + different flavor.} \seetitle[http://pyunit.sourceforge.net/]{PyUnit Web Site}{The source for further information on PyUnit.} *************** *** 129,135 **** \end{verbatim} ! A testcase is created by subclassing \code{unittest.TestCase}. The three individual tests are defined with methods whose names start with ! the letters \code{test}. This naming convention informs the test runner about which methods represent tests. --- 131,137 ---- \end{verbatim} ! A testcase is created by subclassing \class{unittest.TestCase}. The three individual tests are defined with methods whose names start with ! the letters \samp{test}. This naming convention informs the test runner about which methods represent tests. *************** *** 145,151 **** example, \method{setUp()} was used to create a fresh sequence for each test. ! The final block shows a simple way to run the tests. \code{unittest.main()} ! provides a command line interface to the test script. When run from the ! command line, the above script produces an output that looks like this: \begin{verbatim} --- 147,154 ---- example, \method{setUp()} was used to create a fresh sequence for each test. ! The final block shows a simple way to run the tests. ! \function{unittest.main()} provides a command line interface to the ! test script. When run from the command line, the above script ! produces an output that looks like this: \begin{verbatim} *************** *** 157,161 **** \end{verbatim} ! Instead of \code{unittest.main()}, there are other ways to run the tests with a finer level of control, less terse output, and no requirement to be run from the command line. For example, the last two lines may be replaced --- 160,164 ---- \end{verbatim} ! Instead of \function{unittest.main()}, there are other ways to run the tests with a finer level of control, less terse output, and no requirement to be run from the command line. For example, the last two lines may be replaced *************** *** 163,168 **** \begin{verbatim} ! suite = unittest.TestSuite() ! suite.addTest(unittest.makeSuite(TestSequenceFunctions)) unittest.TextTestRunner(verbosity=2).run(suite) \end{verbatim} --- 166,170 ---- \begin{verbatim} ! suite = unittest.makeSuite(TestSequenceFunctions) unittest.TextTestRunner(verbosity=2).run(suite) \end{verbatim} *************** *** 363,372 **** Since it is a common pattern to create a \class{TestCase} subclass with many similarly named test functions, there is a convenience ! function called \function{makeSuite()} provided in the ! \refmodule{unittest} module that constructs a test suite that ! comprises all of the test cases in a test case class: \begin{verbatim} ! suite = unittest.makeSuite(WidgetTestCase,'test') \end{verbatim} --- 365,373 ---- Since it is a common pattern to create a \class{TestCase} subclass with many similarly named test functions, there is a convenience ! function called \function{makeSuite()} that constructs a test suite ! that comprises all of the test cases in a test case class: \begin{verbatim} ! suite = unittest.makeSuite(WidgetTestCase) \end{verbatim} *************** *** 518,522 **** In some cases, the existing tests may have be written using the ! \module{doctest} module. If so, that module provides a \class{DocTestSuite} class that can automatically build \class{unittest.TestSuite} instances from the existing test code. --- 519,523 ---- In some cases, the existing tests may have be written using the ! \refmodule{doctest} module. If so, that module provides a \class{DocTestSuite} class that can automatically build \class{unittest.TestSuite} instances from the existing test code. *************** *** 559,563 **** \begin{methoddesc}[TestCase]{run}{\optional{result}} Run the test, collecting the result into the test result object ! passed as \var{result}. If \var{result} is omitted or \code{None}, a temporary result object is created and used, but is not made available to the caller. This is equivalent to simply calling the --- 560,564 ---- \begin{methoddesc}[TestCase]{run}{\optional{result}} Run the test, collecting the result into the test result object ! passed as \var{result}. If \var{result} is omitted or \constant{None}, a temporary result object is created and used, but is not made available to the caller. This is equivalent to simply calling the *************** *** 579,583 **** Signal a test failure if \var{expr} is false; the explanation for the error will be \var{msg} if given, otherwise it will be ! \code{None}. \end{methoddesc} --- 580,584 ---- Signal a test failure if \var{expr} is false; the explanation for the error will be \var{msg} if given, otherwise it will be ! \constant{None}. \end{methoddesc} *************** *** 586,590 **** Test that \var{first} and \var{second} are equal. If the values do not compare equal, the test will fail with the explanation given by ! \var{msg}, or \code{None}. Note that using \method{failUnlessEqual()} improves upon doing the comparison as the first parameter to \method{failUnless()}: the default value for \var{msg} can be --- 587,591 ---- Test that \var{first} and \var{second} are equal. If the values do not compare equal, the test will fail with the explanation given by ! \var{msg}, or \constant{None}. Note that using \method{failUnlessEqual()} improves upon doing the comparison as the first parameter to \method{failUnless()}: the default value for \var{msg} can be *************** *** 597,601 **** Test that \var{first} and \var{second} are not equal. If the values do compare equal, the test will fail with the explanation given by ! \var{msg}, or \code{None}. Note that using \method{failIfEqual()} improves upon doing the comparison as the first parameter to \method{failUnless()} is that the default value for \var{msg} can be --- 598,602 ---- Test that \var{first} and \var{second} are not equal. If the values do compare equal, the test will fail with the explanation given by ! \var{msg}, or \constant{None}. Note that using \method{failIfEqual()} improves upon doing the comparison as the first parameter to \method{failUnless()} is that the default value for \var{msg} can be *************** *** 613,617 **** is not the same as comparing a given number of significant digits. If the values do not compare equal, the test will fail with the explanation ! given by \var{msg}, or \code{None}. \end{methoddesc} --- 614,618 ---- is not the same as comparing a given number of significant digits. If the values do not compare equal, the test will fail with the explanation ! given by \var{msg}, or \constant{None}. \end{methoddesc} *************** *** 625,629 **** is not the same as comparing a given number of significant digits. If the values do not compare equal, the test will fail with the explanation ! given by \var{msg}, or \code{None}. \end{methoddesc} --- 626,630 ---- is not the same as comparing a given number of significant digits. If the values do not compare equal, the test will fail with the explanation ! given by \var{msg}, or \constant{None}. \end{methoddesc} *************** *** 641,650 **** The inverse of the \method{failUnless()} method is the \method{failIf()} method. This signals a test failure if \var{expr} ! is true, with \var{msg} or \code{None} for the error message. \end{methoddesc} \begin{methoddesc}[TestCase]{fail}{\optional{msg}} Signals a test failure unconditionally, with \var{msg} or ! \code{None} for the error message. \end{methoddesc} --- 642,651 ---- The inverse of the \method{failUnless()} method is the \method{failIf()} method. This signals a test failure if \var{expr} ! is true, with \var{msg} or \constant{None} for the error message. \end{methoddesc} \begin{methoddesc}[TestCase]{fail}{\optional{msg}} Signals a test failure unconditionally, with \var{msg} or ! \constant{None} for the error message. \end{methoddesc} *************** *** 681,688 **** \begin{methoddesc}[TestCase]{shortDescription}{} ! Returns a one-line description of the test, or \code{None} if no description has been provided. The default implementation of this method returns the first line of the test method's docstring, if ! available, or \code{None}. \end{methoddesc} --- 682,689 ---- \begin{methoddesc}[TestCase]{shortDescription}{} ! Returns a one-line description of the test, or \constant{None} if no description has been provided. The default implementation of this method returns the first line of the test method's docstring, if ! available, or \constant{None}. \end{methoddesc} *************** *** 892,896 **** Function to be used to compare method names when sorting them in \method{getTestCaseNames()}. The default value is the built-in ! \function{cmp()} function; it can be set to \code{None} to disable the sort. \end{memberdesc} --- 893,897 ---- Function to be used to compare method names when sorting them in \method{getTestCaseNames()}. The default value is the built-in ! \function{cmp()} function; it can be set to \constant{None} to disable the sort. \end{memberdesc}
participants (1)
-
fdrake@users.sourceforge.net