Message190852
Fixed the test based on Ezio Melotti's advice.
However, Ezio did not comment specifically about whether we should cut or keep this line.
self.assertEqual(list(dup.items()), list(od.items()))
After studying the OrderedDict source code, I came to conclusion that if "self.assertEqual(dup, od)" is true, so is "self.assertEqual(list(dup.items()), list(od.items()))".
But if "self.assertEqual(dup, od)" is false, so is "self.assertEqual(list(dup.items()), list(od.items()))".
This is how OrderedDict tests the equality:
def __eq__(self, other):
if isinstance(other, OrderedDict):
return dict.__eq__(self, other) and all(map(_eq, self, other))
return dict.__eq__(self, other)
So I think it should be safe to remove:
self.assertEqual(list(dup.items()), list(od.items())) |
|
Date |
User |
Action |
Args |
2013-06-09 12:58:28 | vajrasky | set | recipients:
+ vajrasky, rhettinger, terry.reedy, pitrou, ezio.melotti, michael.foord, serhiy.storchaka |
2013-06-09 12:58:28 | vajrasky | set | messageid: <1370782708.82.0.299216803147.issue18106@psf.upfronthosting.co.za> |
2013-06-09 12:58:28 | vajrasky | link | issue18106 messages |
2013-06-09 12:58:28 | vajrasky | create | |
|