unittest.FunctionTestCase.assertItemsEqual

FunctionTestCase.assertItemsEqual(expected_seq, actual_seq, msg=None)

An unordered sequence specific comparison. It asserts that actual_seq and expected_seq have the same element counts. Equivalent to:

self.assertEqual(Counter(iter(actual_seq)),
                 Counter(iter(expected_seq)))

Asserts that each element has the same count in both sequences. Example:

  • [0, 1, 1] and [1, 0, 1] compare equal.
  • [0, 0, 1] and [0, 1] compare unequal.