summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEzio Melotti <ezio.melotti@gmail.com>2013-03-29 03:42:29 +0200
committerEzio Melotti <ezio.melotti@gmail.com>2013-03-29 03:42:29 +0200
commit035ecbe2f4e39175cbaa57daedc377176250923a (patch)
tree56d44ea9a607e74c0a631253c48be3148fd2b338
parent144c269cc8b82ab3b877797e1c7c26b0849e2b56 (diff)
downloadcpython-git-035ecbe2f4e39175cbaa57daedc377176250923a.tar.gz
#8906: document failureException, longMessage, and maxDiff in the class docstring. Patch by Boris Feld.
-rw-r--r--Lib/unittest/case.py23
1 files changed, 11 insertions, 12 deletions
diff --git a/Lib/unittest/case.py b/Lib/unittest/case.py
index b4084640a5..b0cb44a2fc 100644
--- a/Lib/unittest/case.py
+++ b/Lib/unittest/case.py
@@ -150,24 +150,23 @@ class TestCase(object):
should not change the signature of their __init__ method, since instances
of the classes are instantiated automatically by parts of the framework
in order to be run.
- """
- # This attribute 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'
+ 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 = 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
- # 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
# If a string is longer than _diffThreshold, use normal comparison instead