[Python-ideas] unittest: assertEqual(a, b, msg): Show diff AND msg

Gregory P. Smith greg at krypto.org
Mon Apr 25 13:35:10 EDT 2016


On Mon, Apr 25, 2016 at 12:47 AM Thomas Güttler <
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.

Setting it to true manually in all your 2.x code?  recommended!

-gps
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20160425/180904a0/attachment.html>


More information about the Python-ideas mailing list