if isinstance(v1, collections.Iterable) and not isinstance(v1, str):
    self.assertItemsEqual(v1, v2, msg)
else:
    self.assertEqual(v1, v2, msg)
return True

def test_stuff(self):
    lst1 = [1, 2]
lst2 = [2, 1]
d1 = {'key': lst1}
d2 = {'key': lst2}
self.assertItemsEqual(lst1, lst2)
self.assertEqual(d1, d2)
if __name__ == '__main__':
    unittest.main()
How to achieve assertDictEqual with assertSequenceEqual applied to values