cpython: 7eb4fe57492f (original) (raw)
Mercurial > cpython
changeset 104478:7eb4fe57492f 3.5
Issue #26869: Document unittest.TestCase.longMessage. (Mariatta) [#26869]
Guido van Rossum guido@python.org | |
---|---|
date | Thu, 13 Oct 2016 14:23:01 -0700 |
parents | e68b1b2515e9 |
children | d7279d803d1d e05c546062a1 |
files | Doc/library/unittest.rst |
diffstat | 1 files changed, 11 insertions(+), 13 deletions(-)[+] [-] Doc/library/unittest.rst 24 |
line wrap: on
line diff
--- 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[](#l1.7)
:ref:`assert methods <assert-methods>` will be appended to the end of the[](#l1.8)
normal failure message. The normal messages contain useful information[](#l1.9)
about the objects involved, for example the message from assertEqual[](#l1.10)
shows you the repr of the two unequal objects. Setting this attribute[](#l1.11)
to ``True`` allows you to have a custom error message in addition to the[](#l1.12)
normal one.[](#l1.13)
This attribute defaults to ``True``. If set to False then a custom message[](#l1.15)
passed to an assert method will silence the normal message.[](#l1.16)
The class setting can be overridden in individual tests by assigning an[](#l1.18)
instance attribute to ``True`` or ``False`` before calling the assert methods.[](#l1.19)
This class attribute determines what happens when a custom failure message[](#l1.20)
is passed as the msg argument to an assertXYY call that fails.[](#l1.21)
``True`` is the default value. In this case, the custom message is appended[](#l1.22)
to the end of the standard failure message.[](#l1.23)
When set to ``False``, the custom message replaces the standard message.[](#l1.24)
The class setting can be overridden in individual test methods by assigning[](#l1.26)
an instance attribute, self.longMessage, to ``True`` or ``False`` before[](#l1.27)
calling the assert methods.[](#l1.28)
The class setting gets reset before each test call.[](#l1.30)