[Python-ideas] unittest: assertEqual(a, b, msg): Show diff AND msg
Thomas Güttler
guettliml at thomas-guettler.de
Wed Apr 27 03:49:06 EDT 2016
More information about the Python-ideas mailing list
Wed Apr 27 03:49:06 EDT 2016
- Previous message (by thread): [Python-ideas] unittest: assertEqual(a, b, msg): Show diff AND msg
- Next message (by thread): [Python-ideas] Allow with (x as y, z as w):
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I opened a docs issue for "longMessage" http://bugs.python.org/issue26869 Am 26.04.2016 um 10:06 schrieb Thomas Güttler: > > > Am 25.04.2016 um 19:35 schrieb Gregory P. Smith: >> >> On Mon, Apr 25, 2016 at 12:47 AM Thomas Güttler <guettliml at thomas-guettler.de <mailto:guettliml at thomas-guettler.de>> >> wrote: >> >> Up to now assertEqual(a, b, msg) outputs only the msg, not the diff. >> >> I know that setting longMessage to True shows the diff and the msg[1] >> >> I think the sane default is to show the diff and the message for assertEqual(). >> >> What do you think? >> >> >> longMessage already defaults to True in Python 3. >> https://hg.python.org/cpython/file/default/Lib/unittest/case.py#l371 >> >> Changing the default in a future Python 2.7.xx release is unlikely as that kind of change can catch people by surprise >> and cause problems in the middle of a stable release. > > Thank you Gregory! I was blind. > > First I read the Python2 docs, then I read the first line of the docs of Python3: > > > If set to True then any explicit failure ..... > > https://docs.python.org/3/library/unittest.html#unittest.TestCase.longMessage > > Yes, Python3 has the better default. Maybe the docs should get updated. > I guess the above sentence was copied from the old docs where you had to set True. > > "If set to True then ..." is correct if you have a "math brain". But it is confusing > for new comers. > > > > -- Thomas Guettler http://www.thomas-guettler.de/
- Previous message (by thread): [Python-ideas] unittest: assertEqual(a, b, msg): Show diff AND msg
- Next message (by thread): [Python-ideas] Allow with (x as y, z as w):
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-ideas mailing list