[issue7832] assertSameElements([0, 1, 1], [0, 0, 1]) does not fail
report at bugs.python.org
Tue Mar 9 07:28:05 CET 2010
Florent Xicluna <florent.xicluna at gmail.com> added the comment:
Gregory P. Smith wrote:
> Looking through the thousands of uses of assertSameElements in our internal
> code base at work I see many uses of it that are likely not hashable items
> in the sequences being compared.
The method assertSameElements will still support unhashable elements.
In this case the fixed behaviour will be harmless for your code base,
like for many other users. Example with unhashable entries:
assertSameElements(list(, [None], ), tuple([None], , ))
assertSameElements(list(, [None], ), tuple([None], [None], ))
The patch only fix the 2nd case here. Before the patch it didn't fail on
I still don't see real cases where we need that [0, 0, 1] and [0, 1, 1]
And this enhancement will be less surprising for the user.
Currently, if someone uses "assertSameElements" it could expect that it
fails when the count of elements is not the same. And it will never notice
that he's wrong and that his unittest have a flaw.
In a sense, it is not helpful for the end user to preserve the current
behaviour. There's a risk that tests will not fail when they should.
Python tracker <report at bugs.python.org>
More information about the Python-bugs-list