homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: unittest longMessage docs
Type: behavior Stage: resolved
Components: Documentation Versions: Python 3.7, Python 3.6, Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: Mariatta, berker.peksag, docs@python, guettli, gvanrossum, python-dev, terry.reedy
Priority: normal Keywords: patch

Created on 2016年04月27日 07:47 by guettli, last changed 2022年04月11日 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
issue26869.patch Mariatta, 2016年10月05日 04:20 review
Messages (7)
msg264359 - (view) Author: Thomas Guettler (guettli) * Date: 2016年04月27日 07:47
The first message of the longMessage docs is confusing:
https://docs.python.org/3/library/unittest.html#unittest.TestCase.longMessage
> 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?
msg264382 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2016年04月27日 17:35
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."
msg264424 - (view) Author: Thomas Guettler (guettli) * Date: 2016年04月28日 09:20
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
msg278100 - (view) Author: Mariatta (Mariatta) * (Python committer) Date: 2016年10月05日 04:20
Hi, please review the updated documentation.
Thanks.
msg278442 - (view) Author: Thomas Guettler (guettli) * Date: 2016年10月10日 19:52
@Mariatta thank you very much. This update makes the docs easy to read and understand. Thank you :-)
msg278618 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016年10月13日 21:24
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 
msg278619 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2016年10月13日 21:25
Done. Thanks!
History
Date User Action Args
2022年04月11日 14:58:30adminsetgithub: 71056
2016年10月13日 21:25:38gvanrossumsetstatus: open -> closed

nosy: + gvanrossum
messages: + msg278619

resolution: fixed
stage: needs patch -> resolved
2016年10月13日 21:24:56python-devsetnosy: + python-dev
messages: + msg278618
2016年10月10日 19:52:47guettlisetmessages: + msg278442
2016年10月05日 04:20:52Mariattasetfiles: + issue26869.patch
keywords: + patch
messages: + msg278100
2016年09月28日 17:36:38Mariattasetnosy: + Mariatta
2016年09月28日 00:48:33berker.peksagsetnosy: + berker.peksag

versions: + Python 3.7
2016年04月28日 09:20:06guettlisetmessages: + msg264424
2016年04月27日 17:35:15terry.reedysetversions: + Python 3.5
nosy: + terry.reedy

messages: + msg264382

type: behavior
stage: needs patch
2016年04月27日 07:47:47guettlicreate

AltStyle によって変換されたページ (->オリジナル) /