Issue #24286: Forward port dict view abstract base class tests.

This commit is contained in:
Raymond Hettinger 2015-05-26 01:47:58 -07:00
parent 395f92d471
commit c074e9d765
2 changed files with 29 additions and 0 deletions

View file

@ -1867,6 +1867,13 @@ class TestOrderedDict(unittest.TestCase):
od = OrderedDict(**d)
self.assertGreater(sys.getsizeof(od), sys.getsizeof(d))
def test_views(self):
# See http://bugs.python.org/issue24286
s = 'the quick brown fox jumped over a lazy dog yesterday before dawn'.split()
od = OrderedDict.fromkeys(s)
self.assertEqual(od.keys(), dict(od).keys())
self.assertEqual(od.items(), dict(od).items())
def test_override_update(self):
# Verify that subclasses can override update() without breaking __init__()
class MyOD(OrderedDict):