Skip to content

Commit

Permalink
Improve readability of TestCase docstring in case.py
Browse files Browse the repository at this point in the history
Adjusted the indentation and formatting of the attribute list in the TestCase docstring to improve readability and avoid Sphinx documentation build errors. 

The attributes `failureException`, `longMessage`, and `maxDiff` are now more clearly presented with reduced indentation, making the list easier to read and avoiding issues with unexpected indentation in Sphinx. 

No logic or functionality was modified; this change only affects the docstring for documentation purposes.
  • Loading branch information
herver1971 authored Nov 3, 2024
1 parent 9441993 commit ba3e9fd
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions Lib/unittest/case.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,8 @@ def __iter__(self):


class TestCase(object):
"""A class whose instances are single test cases.
"""
A class whose instances are single test cases.
By default, the test code itself should be placed in a method named
'runTest'.
Expand All @@ -381,15 +382,10 @@ class TestCase(object):
in order to be run.
When subclassing TestCase, you can set these attributes:
* failureException: determines which exception will be raised when
the instance's assertion methods fail; test methods raising this
exception will be deemed to have 'failed' rather than 'errored'.
* longMessage: determines whether long messages (including repr of
objects used in assert methods) will be printed on failure in *addition*
to any explicit message passed.
* maxDiff: sets the maximum length of a diff in failure messages
by assert methods using difflib. It is looked up as an instance
attribute so can be configured by individual tests if required.
* failureException: determines which exception will be raised when the instance's assertion methods fail; test methods raising this exception will be deemed to have 'failed' rather than 'errored'.
* longMessage: determines whether long messages (including repr of objects used in assert methods) will be printed on failure in *addition* to any explicit message passed.
* maxDiff: sets the maximum length of a diff in failure messages by assert methods using difflib. It is looked up as an instance attribute so can be configured by individual tests if required.
"""

failureException = AssertionError
Expand Down

0 comments on commit ba3e9fd

Please sign in to comment.