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

Skip to content

Commit 4a45235

Browse files
committed
Issue #26869: Document unittest.TestCase.longMessage. (Mariatta)
1 parent ba29a4f commit 4a45235

1 file changed

Lines changed: 11 additions & 13 deletions

File tree

Doc/library/unittest.rst

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1316,19 +1316,17 @@ Test cases
13161316

13171317
.. attribute:: longMessage
13181318

1319-
If set to ``True`` then any explicit failure message you pass in to the
1320-
:ref:`assert methods <assert-methods>` will be appended to the end of the
1321-
normal failure message. The normal messages contain useful information
1322-
about the objects involved, for example the message from assertEqual
1323-
shows you the repr of the two unequal objects. Setting this attribute
1324-
to ``True`` allows you to have a custom error message in addition to the
1325-
normal one.
1326-
1327-
This attribute defaults to ``True``. If set to False then a custom message
1328-
passed to an assert method will silence the normal message.
1329-
1330-
The class setting can be overridden in individual tests by assigning an
1331-
instance attribute to ``True`` or ``False`` before calling the assert methods.
1319+
This class attribute determines what happens when a custom failure message
1320+
is passed as the msg argument to an assertXYY call that fails.
1321+
``True`` is the default value. In this case, the custom message is appended
1322+
to the end of the standard failure message.
1323+
When set to ``False``, the custom message replaces the standard message.
1324+
1325+
The class setting can be overridden in individual test methods by assigning
1326+
an instance attribute, self.longMessage, to ``True`` or ``False`` before
1327+
calling the assert methods.
1328+
1329+
The class setting gets reset before each test call.
13321330

13331331
.. versionadded:: 3.1
13341332

0 commit comments

Comments
 (0)