unittest wart/bug for assertNotEqual
zac256 at gmail.com
Tue Oct 20 23:45:49 CEST 2009
> I was with you right up to the last six words.
> Whether it's worth changing assertNotEqual to be something other than an
> alias of failIfEqual is an interesting question. Currently all the
> assert* and fail* variants are aliases of each other, which is easy to
> learn. This would introduce a broken symmetry, where assertNotEqual tests
> something different from failIfEqual, and would mean users have to learn
> which assert* methods are aliases of fail* methods, and which are not.
> I'm not sure that's a good idea.
> After all, the documentation is clear on what it does:
> | assertNotEqual = failIfEqual(self, first, second, msg=None)
> | Fail if the two objects are equal as determined by the '=='
> | operator.
> (Taken from help(unittest).)
My preference would be that failIfEqual checks both != and ==. This is
practical, and would benefit almost all use cases. If "!=" isn't "not
==" (IEEE NaNs I hear is the only known use case) then those could
simply not use this method.
It would not surprise me if changing this would bring to light many
Aim - Zac256FL
Production Engineer (Digital Overlord)
More information about the Python-list