From 2532635fcd30f250fe4dce6a3e0cfd0331c92520 Mon Sep 17 00:00:00 2001 From: Ezio Melotti Date: Thu, 8 Aug 2013 20:12:28 +0300 Subject: #18357: add tests for dictview set difference. Patch by Fraser Tweedale. --- Lib/test/test_dictviews.py | 14 ++++++++++++++ Misc/ACKS | 1 + Misc/NEWS | 3 +++ 3 files changed, 18 insertions(+) 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 2279417..2d3b929 100644 --- a/Misc/ACKS +++ b/Misc/ACKS @@ -1252,6 +1252,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 2550dc4..d6a645d 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -237,6 +237,9 @@ IDLE Tests ----- +- Issue #18357: add tests for dictview set difference. + Patch by Fraser Tweedale. + - Issue #18273: move the tests in Lib/test/json_tests to Lib/test/test_json and make them discoverable by unittest. Patch by Zachary Ware. -- cgit v0.12