unittest: assertEqual(a, b, msg): Show diff AND msg

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? Regards, Thomas Güttler [1] longMessage: https://docs.python.org/3/library/unittest.html#unittest.TestCase.longMessag... -- Thomas Guettler http://www.thomas-guettler.de/

On Mon, Apr 25, 2016 at 12:47 AM Thomas Güttler < guettliml@thomas-guettler.de> wrote:
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. Setting it to true manually in all your 2.x code? recommended! -gps

Am 25.04.2016 um 19:35 schrieb Gregory P. Smith:
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.longMessag... 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/

I opened a docs issue for "longMessage" http://bugs.python.org/issue26869 Am 26.04.2016 um 10:06 schrieb Thomas Güttler:
-- Thomas Guettler http://www.thomas-guettler.de/

On Mon, Apr 25, 2016 at 12:47 AM Thomas Güttler < guettliml@thomas-guettler.de> wrote:
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. Setting it to true manually in all your 2.x code? recommended! -gps

Am 25.04.2016 um 19:35 schrieb Gregory P. Smith:
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.longMessag... 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/

I opened a docs issue for "longMessage" http://bugs.python.org/issue26869 Am 26.04.2016 um 10:06 schrieb Thomas Güttler:
-- Thomas Guettler http://www.thomas-guettler.de/
participants (2)
-
Gregory P. Smith
-
Thomas Güttler