Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e02f6c2

Browse files
committed
Issue #22153: Improve unittest docs. Patch from Martin Panter and evilzero.
1 parent 689b55c commit e02f6c2

3 files changed

Lines changed: 11 additions & 4 deletions

File tree

Doc/library/unittest.rst

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -644,10 +644,8 @@ Test cases
644644
kinds of failure.
645645

646646
Each instance of :class:`TestCase` will run a single base method: the method
647-
named *methodName*. However, the standard implementation of the default
648-
*methodName*, ``runTest()``, will run every method starting with ``test``
649-
as an individual test, and count successes and failures accordingly.
650-
Therefore, in most uses of :class:`TestCase`, you will neither change
647+
named *methodName*.
648+
In most uses of :class:`TestCase`, you will neither change
651649
the *methodName* nor reimplement the default ``runTest()`` method.
652650

653651
.. versionchanged:: 3.2
@@ -1551,6 +1549,12 @@ Loading and running tests
15511549
Return a suite of all tests cases contained in the :class:`TestCase`\ -derived
15521550
:class:`testCaseClass`.
15531551

1552+
A test case instance is created for each method named by
1553+
:meth:`getTestCaseNames`. By default these are the method names
1554+
beginning with ``test``. If :meth:`getTestCaseNames` returns no
1555+
methods, but the :meth:`runTest` method is implemented, a single test
1556+
case is created for that method instead.
1557+
15541558

15551559
.. method:: loadTestsFromModule(module)
15561560

Misc/ACKS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1535,3 +1535,4 @@ Doug Zongker
15351535
Peter Åstrand
15361536
Laurent De Buyst
15371537
Nicola Palumbo
1538+
evilzero

Misc/NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ Core and Builtins
6666
Library
6767
-------
6868

69+
- Issue #22153: Improve unittest docs. Patch from Martin Panter and evilzero.
70+
6971
- Issue #24206: Fixed __eq__ and __ne__ methods of inspect classes.
7072

7173
- Issue #21750: mock_open.read_data can now be read from each instance, as it

0 commit comments

Comments
 (0)