summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_dictviews.py
diff options
context:
space:
mode:
authorEzio Melotti <ezio.melotti@gmail.com>2013-08-08 17:12:28 (GMT)
committerEzio Melotti <ezio.melotti@gmail.com>2013-08-08 17:12:28 (GMT)
commit2532635fcd30f250fe4dce6a3e0cfd0331c92520 (patch)
tree892e8793a515ef88e185a28d5c7e232c3afc04ca /Lib/test/test_dictviews.py
parent4e4f3b8d353803003c5f114a29f3b0ab1596fe24 (diff)
downloadcpython-2532635fcd30f250fe4dce6a3e0cfd0331c92520.zip
cpython-2532635fcd30f250fe4dce6a3e0cfd0331c92520.tar.gz
cpython-2532635fcd30f250fe4dce6a3e0cfd0331c92520.tar.bz2
#18357: add tests for dictview set difference. Patch by Fraser Tweedale.
Diffstat (limited to 'Lib/test/test_dictviews.py')
-rw-r--r--Lib/test/test_dictviews.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/Lib/test/test_dictviews.py b/Lib/test/test_dictviews.py
index ac8bfe6..7b02ea9 100644
--- a/Lib/test/test_dictviews.py
+++ b/Lib/test/test_dictviews.py
@@ -112,6 +112,13 @@ class DictSetTest(unittest.TestCase):
self.assertEqual(d1.keys() ^ set(d3.keys()),
{'a', 'b', 'd', 'e'})
+ self.assertEqual(d1.keys() - d1.keys(), set())
+ self.assertEqual(d1.keys() - d2.keys(), {'a'})
+ self.assertEqual(d1.keys() - d3.keys(), {'a', 'b'})
+ self.assertEqual(d1.keys() - set(d1.keys()), set())
+ self.assertEqual(d1.keys() - set(d2.keys()), {'a'})
+ self.assertEqual(d1.keys() - set(d3.keys()), {'a', 'b'})
+
self.assertFalse(d1.keys().isdisjoint(d1.keys()))
self.assertFalse(d1.keys().isdisjoint(d2.keys()))
self.assertFalse(d1.keys().isdisjoint(list(d2.keys())))
@@ -162,6 +169,13 @@ class DictSetTest(unittest.TestCase):
self.assertEqual(d1.items() ^ d3.items(),
{('a', 1), ('b', 2), ('d', 4), ('e', 5)})
+ self.assertEqual(d1.items() - d1.items(), set())
+ self.assertEqual(d1.items() - d2.items(), {('a', 1)})
+ self.assertEqual(d1.items() - d3.items(), {('a', 1), ('b', 2)})
+ self.assertEqual(d1.items() - set(d1.items()), set())
+ self.assertEqual(d1.items() - set(d2.items()), {('a', 1)})
+ self.assertEqual(d1.items() - set(d3.items()), {('a', 1), ('b', 2)})
+
self.assertFalse(d1.items().isdisjoint(d1.items()))
self.assertFalse(d1.items().isdisjoint(d2.items()))
self.assertFalse(d1.items().isdisjoint(list(d2.items())))