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

Skip to content

Commit 31797e5

Browse files
committed
#8906: document failureException, longMessage, and maxDiff in the class docstring. Patch by Boris Feld.
1 parent a5d55ba commit 31797e5

1 file changed

Lines changed: 11 additions & 12 deletions

File tree

Lib/unittest/case.py

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -237,24 +237,23 @@ class TestCase(object):
237237
should not change the signature of their __init__ method, since instances
238238
of the classes are instantiated automatically by parts of the framework
239239
in order to be run.
240-
"""
241240
242-
# This attribute determines which exception will be raised when
243-
# the instance's assertion methods fail; test methods raising this
244-
# exception will be deemed to have 'failed' rather than 'errored'
241+
When subclassing TestCase, you can set these attributes:
242+
* failureException: determines which exception will be raised when
243+
the instance's assertion methods fail; test methods raising this
244+
exception will be deemed to have 'failed' rather than 'errored'.
245+
* longMessage: determines whether long messages (including repr of
246+
objects used in assert methods) will be printed on failure in *addition*
247+
to any explicit message passed.
248+
* maxDiff: sets the maximum length of a diff in failure messages
249+
by assert methods using difflib. It is looked up as an instance
250+
attribute so can be configured by individual tests if required.
251+
"""
245252

246253
failureException = AssertionError
247254

248-
# This attribute determines whether long messages (including repr of
249-
# objects used in assert methods) will be printed on failure in *addition*
250-
# to any explicit message passed.
251-
252255
longMessage = True
253256

254-
# This attribute sets the maximum length of a diff in failure messages
255-
# by assert methods using difflib. It is looked up as an instance attribute
256-
# so can be configured by individual tests if required.
257-
258257
maxDiff = 80*8
259258

260259
# If a string is longer than _diffThreshold, use normal comparison instead

0 commit comments

Comments
 (0)