[issue46610] assertCountEqual doesn't work as expected for dictionary elements

Raymond Hettinger report at bugs.python.org
Wed Feb 2 10:46:38 EST 2022


Raymond Hettinger <raymond.hettinger at gmail.com> added the comment:

I agree with Eric that this should not be changed.  It is working as documented and intended.

In its original incarenation, assertCountEqual was documented as being equivalent to ``assertEqual(sorted(expected), sorted(actual))``.  Either way, the goal was to count the values produced by iterating.

To compare two dicts or two Counters including both keys and values, just use assertEqual.

----------
nosy: +rhettinger

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


More information about the Python-bugs-list mailing list