[issue26869] unittest longMessage docs
![](https://secure.gravatar.com/avatar/fa0f7819f1825f596b384c19aa7dcf33.jpg?s=120&d=mm&r=g)
New submission from Thomas Guettler: The first message of the longMessage docs is confusing: https://docs.python.org/3/library/unittest.html#unittest.TestCase.longMessag...
If set to True then ....
This reads between the lines, that the default is False. But that was long ago in Python2. In Python3 the default is True (which I prefer to the old default). I think the docs should be like. And the term "normal message" is not defined. For new comers the "normal message" is what I get if you don't change the default, not the behaviour of the Python2 version :-) I think "normal message" should be replaced with "short message" or "diff message" .. I am unsure. What do you think? ---------- assignee: docs@python components: Documentation messages: 264359 nosy: docs@python, guettli priority: normal severity: normal status: open title: unittest longMessage docs versions: Python 3.6 _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue26869> _______________________________________
![](https://secure.gravatar.com/avatar/fa0f7819f1825f596b384c19aa7dcf33.jpg?s=120&d=mm&r=g)
Terry J. Reedy added the comment: Replace existing description with "This class attribute determines what happens when a custom failure message is passed as the msg argument to an assertXYY call that fails. If True, the default, the custom message is appended to the end of the standard failure message. If False, the custom message replaces the standard message. The standard failure message for each *assert method* contains useful information about the objects involved. For example the message from assertEqual shows the repr of the two unequal objects. It is usually easier to augment rather than replace this 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. New in version 3.1." ---------- nosy: +terry.reedy stage: -> needs patch type: -> behavior versions: +Python 3.5 _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue26869> _______________________________________
![](https://secure.gravatar.com/avatar/fa0f7819f1825f596b384c19aa7dcf33.jpg?s=120&d=mm&r=g)
Thomas Guettler added the comment: Thank you for understanding my concern.
The standard failure message for each *assert method* contains useful information about the objects involved. For example the message from assertEqual shows the repr of the two unequal objects. It is usually easier to augment rather than replace this message
I think above is not needed.
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.
I would add "the default value of the class gets reset before each test call". That is more explicit (I hope my text is what happens behind the scene) Again, thank you, that you care. Regards, Thomas Güttler ---------- _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue26869> _______________________________________
![](https://secure.gravatar.com/avatar/fa0f7819f1825f596b384c19aa7dcf33.jpg?s=120&d=mm&r=g)
Changes by Berker Peksag <berker.peksag@gmail.com>: ---------- nosy: +berker.peksag versions: +Python 3.7 _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue26869> _______________________________________
![](https://secure.gravatar.com/avatar/fa0f7819f1825f596b384c19aa7dcf33.jpg?s=120&d=mm&r=g)
Changes by Mariatta Wijaya <mariatta.wijaya@gmail.com>: ---------- nosy: +Mariatta _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue26869> _______________________________________
![](https://secure.gravatar.com/avatar/fa0f7819f1825f596b384c19aa7dcf33.jpg?s=120&d=mm&r=g)
Mariatta Wijaya added the comment: Hi, please review the updated documentation. Thanks. ---------- keywords: +patch Added file: http://bugs.python.org/file44965/issue26869.patch _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue26869> _______________________________________
![](https://secure.gravatar.com/avatar/fa0f7819f1825f596b384c19aa7dcf33.jpg?s=120&d=mm&r=g)
Thomas Guettler added the comment: @Mariatta thank you very much. This update makes the docs easy to read and understand. Thank you :-) ---------- _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue26869> _______________________________________
![](https://secure.gravatar.com/avatar/fa0f7819f1825f596b384c19aa7dcf33.jpg?s=120&d=mm&r=g)
Roundup Robot added the comment: New changeset 7eb4fe57492f by Guido van Rossum in branch '3.5': Issue #26869: Document unittest.TestCase.longMessage. (Mariatta) https://hg.python.org/cpython/rev/7eb4fe57492f New changeset d7279d803d1d by Guido van Rossum in branch '3.6': Issue #26869: Document unittest.TestCase.longMessage. (Mariatta) (3.5->3.6) https://hg.python.org/cpython/rev/d7279d803d1d New changeset c7c428350578 by Guido van Rossum in branch 'default': Issue #26869: Document unittest.TestCase.longMessage. (Mariatta) (3.6->3.7) https://hg.python.org/cpython/rev/c7c428350578 ---------- nosy: +python-dev _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue26869> _______________________________________
![](https://secure.gravatar.com/avatar/fa0f7819f1825f596b384c19aa7dcf33.jpg?s=120&d=mm&r=g)
Guido van Rossum added the comment: Done. Thanks! ---------- nosy: +gvanrossum resolution: -> fixed stage: needs patch -> resolved status: open -> closed _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue26869> _______________________________________
participants (6)
-
Berker Peksag
-
Guido van Rossum
-
Mariatta Wijaya
-
Roundup Robot
-
Terry J. Reedy
-
Thomas Guettler