Vajrasky Kok added the comment:

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()))

----------
Added file: http://bugs.python.org/file30513/test_copying_trimmed.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue18106>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to