[issue14832] unittest's assertItemsEqual() method gives wrong order in error output

Kylotan report at bugs.python.org
Wed May 16 18:47:49 CEST 2012


New submission from Kylotan <kylotan at gmail.com>:

I have the following line in a unit test in 2.7.3:

    self.assertItemsEqual(['a', 'b', 'c'], ['a', 'b', 'c', 'd'])

I expect this output:

    AssertionError: Element counts were not equal:
    First has 0, Second has 1:  'd'

Instead I get this output:

    AssertionError: Element counts were not equal:
    First has 1, Second has 0:  'd'

I would expect 'First' to refer to the first sequence I pass to assertItemsEqual, not the second, and vice versa.

(Obviously in a trivial example like this it appears unimportant, but when debugging why a test has failed, the unexpected ordering can cause problems.)

----------
messages: 160887
nosy: Kylotan
priority: normal
severity: normal
status: open
title: unittest's assertItemsEqual() method gives wrong order in error output
versions: Python 2.7

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


More information about the Python-bugs-list mailing list