summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_dictviews.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-02-10 01:11:45 (GMT)
committerGuido van Rossum <guido@python.org>2007-02-10 01:11:45 (GMT)
commitb90c84889eb1d98957dc80c0420df41d6ce32e40 (patch)
treef2c7e823b987b6f187e3d41bc04376b28381e0fa /Lib/test/test_dictviews.py
parent8b545369eac66c963633d309eac7f71eff7b4326 (diff)
downloadcpython-b90c84889eb1d98957dc80c0420df41d6ce32e40.zip
cpython-b90c84889eb1d98957dc80c0420df41d6ce32e40.tar.gz
cpython-b90c84889eb1d98957dc80c0420df41d6ce32e40.tar.bz2
Very preliminary work on dict views.
Diffstat (limited to 'Lib/test/test_dictviews.py')
-rw-r--r--Lib/test/test_dictviews.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/Lib/test/test_dictviews.py b/Lib/test/test_dictviews.py
new file mode 100644
index 0000000..15c933f
--- /dev/null
+++ b/Lib/test/test_dictviews.py
@@ -0,0 +1,25 @@
+import unittest
+from test import test_support
+
+class DictSetTest(unittest.TestCase):
+
+ def test_dict_keys(self):
+ d = {1: 10, "a": "ABC"}
+ keys = d.KEYS()
+ self.assertEqual(set(keys), {1, "a"})
+
+ def test_dict_items(self):
+ d = {1: 10, "a": "ABC"}
+ items = d.ITEMS()
+ self.assertEqual(set(items), {(1, 10), ("a", "ABC")})
+
+ def test_dict_values(self):
+ d = {1: 10, "a": "ABC"}
+ values = d.VALUES()
+ self.assertEqual(set(values), {10, "ABC"})
+
+def test_main():
+ test_support.run_unittest(DictSetTest)
+
+if __name__ == "__main__":
+ test_main()