summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-08-24 23:47:30 (GMT)
committerGuido van Rossum <guido@python.org>2007-08-24 23:47:30 (GMT)
commit1d719960131b1d288085c5d2df6d7d2dfbdfb54e (patch)
treef26d70e9932dc6e748e46ef46e5fa54a76fe8804
parentbe534719dae5a6824e6dffb9a1e38a08b91096cf (diff)
downloadcpython-1d719960131b1d288085c5d2df6d7d2dfbdfb54e.zip
cpython-1d719960131b1d288085c5d2df6d7d2dfbdfb54e.tar.gz
cpython-1d719960131b1d288085c5d2df6d7d2dfbdfb54e.tar.bz2
Add some mixed operations between sets and dict views.
-rw-r--r--Lib/test/test_dict.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_dict.py b/Lib/test/test_dict.py
index a83787f..a9e4156 100644
--- a/Lib/test/test_dict.py
+++ b/Lib/test/test_dict.py
@@ -488,6 +488,14 @@ class DictTest(unittest.TestCase):
self.assertEquals(k1 ^ k2, {(3,3)})
self.assertEquals(k1 ^ k3, {(1,1), (2,2), (4,4)})
+ def test_dictview_mixed_set_operations(self):
+ # Just a few for .keys()
+ self.assertEquals({1:1}.keys() | {2}, {1, 2})
+ self.assertEquals({2} | {1:1}.keys(), {1, 2})
+ # And a few for .items()
+ self.assertEquals({1:1}.items() | {2}, {(1,1), 2})
+ self.assertEquals({2} | {1:1}.items(), {(1,1), 2})
+
def test_missing(self):
# Make sure dict doesn't have a __missing__ method
self.assertEqual(hasattr(dict, "__missing__"), False)