[New-bugs-announce] [issue10242] unittest's assertItemsEqual() method makes too many assumptions about its input

Raymond Hettinger report at bugs.python.org
Sat Oct 30 07:26:12 CEST 2010


New submission from Raymond Hettinger <rhettinger at users.sourceforge.net>:

class T(unittest.TestCase):
    def test_items_equal(self):
        # this test fails, but should succeed
        a = [{2,4}, {1,2}]
        b = a[::-1]
        self.assertItemsEqual(a, b)

This method has a fast-path using sorted() and a slow-path that doesn't care about cross-type comparisons.  The fast-path is incorrect though and gets the wrong answer in the above test case.

----------
assignee: michael.foord
messages: 119960
nosy: michael.foord, rhettinger
priority: high
severity: normal
status: open
title: unittest's assertItemsEqual() method makes too many assumptions about its input
versions: Python 2.7, Python 3.2

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


More information about the New-bugs-announce mailing list