[Python-Dev] Cleaning-up the new unittest API (original) (raw)

Matthew Woodcraft matthew at woodcraft.me.uk
Sun Oct 31 23:47:58 CET 2010


Raymond Hettinger <raymond.hettinger at gmail.com> wrote:

I looked at this again and think we should just remove assertItemsEqual() from Py3.2 and dedocument it in Py2.7. It is listed as being new in 3.2 so nothing is lost.

One thing that would be lost is that correct Python 2.7 code using assertItemsEqual would no longer run on 3.2.

The sole benefit over the more explicit variants like assertEqual(set(a), set(b)) and assertEqual(sorted(a), sorted(b)) is that it handles a somewhat rare corner case where neither of those work (unordered comparison of non-compable types when you do care about duplicates).

Another benefit is that it gives better descriptions of differences. See http://bugs.python.org/issue9977 for an example.

-M-



More information about the Python-Dev mailing list