[issue7832] assertSameElements([0, 1, 1], [0, 0, 1]) does not fail

Gregory P. Smith report at bugs.python.org
Tue Mar 9 02:46:46 CET 2010


Gregory P. Smith <greg at krypto.org> added the comment:

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 largest use of course is with lists and tuples of hashables where another assert method may have even made more sense, but that is not the only use.

As documented in Python 3.1 I think the behavior of assertSameElements is accurate and makes sense.  We should add an extra note to the documentation to explicitly mention that it does not care how many of a given element occur in either sequence.  [0, 1, 1] and [0, 0, 1] do in fact have the same elements.

If you want a different behavior please add that as a feature.  As such, Ezio's option (b) and (d) are the only ones I'm in favor of.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7832>
_______________________________________


More information about the Python-bugs-list mailing list