diff options
| author | Georg Brandl <georg@python.org> | 2009-04-27 17:04:23 (GMT) |
|---|---|---|
| committer | Georg Brandl <georg@python.org> | 2009-04-27 17:04:23 (GMT) |
| commit | 9bc668251f260d3edd71555cd7027e15927ed8ad (patch) | |
| tree | 01762cf20ad95e41ed2f7943fe5becc74e662565 | |
| parent | b44c9f357da700e5a7b985d222b384939928109d (diff) | |
| download | cpython-9bc668251f260d3edd71555cd7027e15927ed8ad.zip cpython-9bc668251f260d3edd71555cd7027e15927ed8ad.tar.gz cpython-9bc668251f260d3edd71555cd7027e15927ed8ad.tar.bz2 | |
#5848: small unittest doc patch.
| -rw-r--r-- | Doc/library/unittest.rst | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/Doc/library/unittest.rst b/Doc/library/unittest.rst index 6b19c29..16da21c 100644 --- a/Doc/library/unittest.rst +++ b/Doc/library/unittest.rst @@ -955,7 +955,6 @@ Test cases 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 @@ Grouping tests 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 @@ Loading and running tests unexpected exception. .. versionchanged:: 2.2 - Contains formatted tracebacks instead of :func:`sys.exc_info` results. @@ -1206,7 +1218,6 @@ Loading and running tests :meth:`TestCase.assert\*` methods. .. versionchanged:: 2.2 - Contains formatted tracebacks instead of :func:`sys.exc_info` results. .. attribute:: skipped @@ -1346,6 +1357,12 @@ Loading and running tests 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]]]]]) |
