mirror of
https://github.com/python/cpython.git
synced 2025-09-27 02:39:58 +00:00
#8906: document failureException, longMessage, and maxDiff in the class docstring. Patch by Boris Feld.
This commit is contained in:
parent
144c269cc8
commit
035ecbe2f4
1 changed files with 11 additions and 12 deletions
|
@ -150,24 +150,23 @@ class TestCase(object):
|
||||||
should not change the signature of their __init__ method, since instances
|
should not change the signature of their __init__ method, since instances
|
||||||
of the classes are instantiated automatically by parts of the framework
|
of the classes are instantiated automatically by parts of the framework
|
||||||
in order to be run.
|
in order to be run.
|
||||||
"""
|
|
||||||
|
|
||||||
# This attribute determines which exception will be raised when
|
When subclassing TestCase, you can set these attributes:
|
||||||
# the instance's assertion methods fail; test methods raising this
|
* failureException: determines which exception will be raised when
|
||||||
# exception will be deemed to have 'failed' rather than 'errored'
|
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
|
failureException = AssertionError
|
||||||
|
|
||||||
# This attribute determines whether long messages (including repr of
|
|
||||||
# objects used in assert methods) will be printed on failure in *addition*
|
|
||||||
# to any explicit message passed.
|
|
||||||
|
|
||||||
longMessage = False
|
longMessage = False
|
||||||
|
|
||||||
# This attribute 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.
|
|
||||||
|
|
||||||
maxDiff = 80*8
|
maxDiff = 80*8
|
||||||
|
|
||||||
# If a string is longer than _diffThreshold, use normal comparison instead
|
# If a string is longer than _diffThreshold, use normal comparison instead
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue