diff options
author | Eric Snow <ericsnowcurrently@gmail.com> | 2015-05-30 17:43:36 (GMT) |
---|---|---|
committer | Eric Snow <ericsnowcurrently@gmail.com> | 2015-05-30 17:43:36 (GMT) |
commit | 67fb92e8c690ccb0d3a557affcc6b46c13cb94b0 (patch) | |
tree | fa2117381c4e9e7f826f5bc2379fd4ee2f39b163 /Lib/test/test_collections.py | |
parent | c5e59609ac9947e91e7c2633c1e3634ff766ab08 (diff) | |
download | cpython-67fb92e8c690ccb0d3a557affcc6b46c13cb94b0.zip cpython-67fb92e8c690ccb0d3a557affcc6b46c13cb94b0.tar.gz cpython-67fb92e8c690ccb0d3a557affcc6b46c13cb94b0.tar.bz2 |
Issue #16991: Do not return None from OrderedDict.__reversed__.
Diffstat (limited to 'Lib/test/test_collections.py')
-rw-r--r-- | Lib/test/test_collections.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/Lib/test/test_collections.py b/Lib/test/test_collections.py index 3bb326a..3f02129 100644 --- a/Lib/test/test_collections.py +++ b/Lib/test/test_collections.py @@ -1773,6 +1773,19 @@ class OrderedDictTests: self.assertEqual(sorted(reversed(od)), sorted([t[0] for t in reversed(pairs)])) + def test_iterators_empty(self): + OrderedDict = self.module.OrderedDict + od = OrderedDict() + empty = [] + self.assertEqual(list(od), empty) + self.assertEqual(list(od.keys()), empty) + self.assertEqual(list(od.values()), empty) + self.assertEqual(list(od.items()), empty) + self.assertEqual(list(reversed(od)), empty) + self.assertEqual(list(reversed(od.keys())), empty) + self.assertEqual(list(reversed(od.values())), empty) + self.assertEqual(list(reversed(od.items())), empty) + def test_popitem(self): OrderedDict = self.module.OrderedDict pairs = [('c', 1), ('b', 2), ('a', 3), ('d', 4), ('e', 5), ('f', 6)] @@ -1965,7 +1978,6 @@ class OrderedDictTests: od = OrderedDict(**d) self.assertGreater(sys.getsizeof(od), sys.getsizeof(d)) - OrderedDict = self.module.OrderedDict def test_override_update(self): OrderedDict = self.module.OrderedDict # Verify that subclasses can override update() without breaking __init__() |