[issue38706] What should the error message in the exception raised by assertTrue and assertFalse be?

Mark Dickinson report at bugs.python.org
Thu Nov 7 13:13:43 EST 2019


Mark Dickinson <dickinsm at gmail.com> added the comment:

[Terry]

> A correct failure message, correct both as English and Python, should be something like 'bool(x) is not True'.  I see 'x is not true' as an informal English equivalent of the full claim.

I'm not clear whether you're suggesting having something like "bool(x) is not True" be the actual failure message, but if you are, that makes a lot of sense to me. (My current advice to coworkers is always to include the "msg" attribute when using assertTrue and assertFalse, because the default message tends to be spectacularly unhelpful.)

-1 on introducing the terms "truthy" and "falsy" (or "falsey"?) into this one corner of Python. Given that those terms don't seem to be used elsewhere in the codebase, I'd expect introducing them here to cause more confusion, rather than less.

----------
nosy: +mark.dickinson

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38706>
_______________________________________


More information about the Python-bugs-list mailing list