summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_dictviews.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2015-05-26 08:47:58 (GMT)
committerRaymond Hettinger <python@rcn.com>2015-05-26 08:47:58 (GMT)
commitc074e9d765505df971fc89e21d512b40f85e1d6b (patch)
treeba8b789dc30f2da5aa57bd7659acd43af54d088e /Lib/test/test_dictviews.py
parent395f92d471378953bc67fc568982639a00f1b318 (diff)
downloadcpython-c074e9d765505df971fc89e21d512b40f85e1d6b.zip
cpython-c074e9d765505df971fc89e21d512b40f85e1d6b.tar.gz
cpython-c074e9d765505df971fc89e21d512b40f85e1d6b.tar.bz2
Issue #24286: Forward port dict view abstract base class tests.
Diffstat (limited to 'Lib/test/test_dictviews.py')
-rw-r--r--Lib/test/test_dictviews.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/Lib/test/test_dictviews.py b/Lib/test/test_dictviews.py
index 280353a..d96832e 100644
--- a/Lib/test/test_dictviews.py
+++ b/Lib/test/test_dictviews.py
@@ -1,3 +1,4 @@
+import collections
import unittest
class DictSetTest(unittest.TestCase):
@@ -197,6 +198,27 @@ class DictSetTest(unittest.TestCase):
d[42] = d.values()
self.assertRaises(RuntimeError, repr, d)
+ def test_abc_registry(self):
+ d = dict(a=1)
+
+ self.assertIsInstance(d.keys(), collections.KeysView)
+ self.assertIsInstance(d.keys(), collections.MappingView)
+ self.assertIsInstance(d.keys(), collections.Set)
+ self.assertIsInstance(d.keys(), collections.Sized)
+ self.assertIsInstance(d.keys(), collections.Iterable)
+ self.assertIsInstance(d.keys(), collections.Container)
+
+ self.assertIsInstance(d.values(), collections.ValuesView)
+ self.assertIsInstance(d.values(), collections.MappingView)
+ self.assertIsInstance(d.values(), collections.Sized)
+
+ self.assertIsInstance(d.items(), collections.ItemsView)
+ self.assertIsInstance(d.items(), collections.MappingView)
+ self.assertIsInstance(d.items(), collections.Set)
+ self.assertIsInstance(d.items(), collections.Sized)
+ self.assertIsInstance(d.items(), collections.Iterable)
+ self.assertIsInstance(d.items(), collections.Container)
+
if __name__ == "__main__":
unittest.main()