[Python-checkins] r72036 - python/trunk/Doc/library/unittest.rst

georg.brandl python-checkins at python.org
Mon Apr 27 19:04:23 CEST 2009


Author: georg.brandl
Date: Mon Apr 27 19:04:23 2009
New Revision: 72036

Log:
#5848: small unittest doc patch.

Modified:
   python/trunk/Doc/library/unittest.rst

Modified: python/trunk/Doc/library/unittest.rst
==============================================================================
--- python/trunk/Doc/library/unittest.rst	(original)
+++ python/trunk/Doc/library/unittest.rst	Mon Apr 27 19:04:23 2009
@@ -955,7 +955,6 @@
       along with the method name.
 
       .. versionchanged:: 2.7
-
          In earlier versions this only returned the first line of the test
          method's docstring, if available or the :const:`None`.  That led to
          undesirable behavior of not printing the test name when someone was
@@ -1047,6 +1046,20 @@
       Return the number of tests represented by this test object, including all
       individual tests and sub-suites.
 
+
+   .. method:: __iter__()
+
+      Tests grouped by a :class:`TestSuite` are always accessed by iteration.
+      Subclasses can lazily provide tests by overriding :meth:`__iter__`. Note
+      that this method maybe called several times on a single suite
+      (for example when counting tests or comparing for equality)
+      so the tests returned must be the same for repeated iterations.
+
+      .. versionchanged:: 2.7
+         In earlier versions the :class:`TestSuite` accessed tests directly rather
+         than through iteration, so overriding :meth:`__iter__` wasn't sufficient
+         for providing tests.
+
    In the typical usage of a :class:`TestSuite` object, the :meth:`run` method
    is invoked by a :class:`TestRunner` rather than by the end-user test harness.
 
@@ -1194,7 +1207,6 @@
       unexpected exception.
 
       .. versionchanged:: 2.2
-
          Contains formatted tracebacks instead of :func:`sys.exc_info` results.
 
 
@@ -1206,7 +1218,6 @@
       :meth:`TestCase.assert\*` methods.
 
       .. versionchanged:: 2.2
-
          Contains formatted tracebacks instead of :func:`sys.exc_info` results.
 
    .. attribute:: skipped
@@ -1346,6 +1357,12 @@
    has a few configurable parameters, but is essentially very simple.  Graphical
    applications which run test suites should provide alternate implementations.
 
+   .. method:: _makeResult()
+
+      This method returns the instance of ``TestResult`` used by :meth:`run`.
+      It is not intended to be called directly, but can be overridden in
+      subclasses to provide a custom ``TestResult``.
+
 
 .. function:: main([module[, defaultTest[, argv[, testRunner[, testLoader]]]]])
 


More information about the Python-checkins mailing list