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

Skip to content

Commit 38de40d

Browse files
committed
Issue #22153: Improve unittest docs. Patch from Martin Panter and evilzero.
2 parents b575432 + e02f6c2 commit 38de40d

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
@@ -651,10 +651,8 @@ Test cases
651651
kinds of failure.
652652

653653
Each instance of :class:`TestCase` will run a single base method: the method
654-
named *methodName*. However, the standard implementation of the default
655-
*methodName*, ``runTest()``, will run every method starting with ``test``
656-
as an individual test, and count successes and failures accordingly.
657-
Therefore, in most uses of :class:`TestCase`, you will neither change
654+
named *methodName*.
655+
In most uses of :class:`TestCase`, you will neither change
658656
the *methodName* nor reimplement the default ``runTest()`` method.
659657

660658
.. versionchanged:: 3.2
@@ -1572,6 +1570,12 @@ Loading and running tests
15721570
Return a suite of all tests cases contained in the :class:`TestCase`\ -derived
15731571
:class:`testCaseClass`.
15741572

1573+
A test case instance is created for each method named by
1574+
:meth:`getTestCaseNames`. By default these are the method names
1575+
beginning with ``test``. If :meth:`getTestCaseNames` returns no
1576+
methods, but the :meth:`runTest` method is implemented, a single test
1577+
case is created for that method instead.
1578+
15751579

15761580
.. method:: loadTestsFromModule(module, pattern=None)
15771581

Misc/ACKS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1584,3 +1584,4 @@ Peter Åstrand
15841584
Ignacio Rossi
15851585
Laurent De Buyst
15861586
Nicola Palumbo
1587+
evilzero

Misc/NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ Core and Builtins
2525
Library
2626
-------
2727

28+
- Issue #22153: Improve unittest docs. Patch from Martin Panter and evilzero.
29+
2830
- Issue #24580: Symbolic group references to open group in re patterns now are
2931
explicitly forbidden as well as numeric group references.
3032

0 commit comments

Comments
 (0)