summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Lib/test/test_dictviews.py14
-rw-r--r--Misc/ACKS1
-rw-r--r--Misc/NEWS3
3 files changed, 18 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())))
diff --git a/Misc/ACKS b/Misc/ACKS
index 6d7fcfc..7717941 100644
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -1290,6 +1290,7 @@ David Turner
Stephen Turner
Theodore Turocy
Bill Tutt
+Fraser Tweedale
Doobee R. Tzeck
Eren Türkay
Lionel Ulmer
diff --git a/Misc/NEWS b/Misc/NEWS
index 0772cd2..d1f0761 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -350,6 +350,9 @@ Library
when \r\n appears at end of 65535 bytes without other newlines.
- Issue #18076: Introduce importlib.util.decode_source().
+- Issue #18357: add tests for dictview set difference.
+ Patch by Fraser Tweedale.
+
- importlib.abc.SourceLoader.get_source() no longer changes SyntaxError or
UnicodeDecodeError into ImportError.