diff options
author | Guido van Rossum <guido@python.org> | 2016-10-13 21:24:23 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2016-10-13 21:24:23 (GMT) |
commit | 5236ac600ea59f8ddd89d6dfc6148cd8a8282d40 (patch) | |
tree | 9b0566777d8174f385d8427fc0d392464a824b84 /Doc/library/unittest.rst | |
parent | a03b1ea4113f2d7fcdecdbb7209a15ac30b25429 (diff) | |
parent | 4a4523523ea73010b856336b27ddf952132a202f (diff) | |
download | cpython-5236ac600ea59f8ddd89d6dfc6148cd8a8282d40.zip cpython-5236ac600ea59f8ddd89d6dfc6148cd8a8282d40.tar.gz cpython-5236ac600ea59f8ddd89d6dfc6148cd8a8282d40.tar.bz2 |
Issue #26869: Document unittest.TestCase.longMessage. (Mariatta) (3.5->3.6)
Diffstat (limited to 'Doc/library/unittest.rst')
-rw-r--r-- | Doc/library/unittest.rst | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/Doc/library/unittest.rst b/Doc/library/unittest.rst index dd188b0..128597c 100644 --- a/Doc/library/unittest.rst +++ b/Doc/library/unittest.rst @@ -1316,19 +1316,17 @@ Test cases .. attribute:: longMessage - If set to ``True`` then any explicit failure message you pass in to the - :ref:`assert methods <assert-methods>` will be appended to the end of the - normal failure message. The normal messages contain useful information - about the objects involved, for example the message from assertEqual - shows you the repr of the two unequal objects. Setting this attribute - to ``True`` allows you to have a custom error message in addition to the - normal one. - - This attribute defaults to ``True``. If set to False then a custom message - passed to an assert method will silence the normal message. - - The class setting can be overridden in individual tests by assigning an - instance attribute to ``True`` or ``False`` before calling the assert methods. + This class attribute determines what happens when a custom failure message + is passed as the msg argument to an assertXYY call that fails. + ``True`` is the default value. In this case, the custom message is appended + to the end of the standard failure message. + When set to ``False``, the custom message replaces the standard message. + + The class setting can be overridden in individual test methods by assigning + an instance attribute, self.longMessage, to ``True`` or ``False`` before + calling the assert methods. + + The class setting gets reset before each test call. .. versionadded:: 3.1 |