diff options
author | Raymond Hettinger <python@rcn.com> | 2008-06-11 10:30:54 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2008-06-11 10:30:54 (GMT) |
commit | 4267be6478d38445b8632e678e3cf459490bed6b (patch) | |
tree | 98d5c6de7a13e23bb4a29c37b7e8aa3e7ebbcad0 /Lib/test/test_set.py | |
parent | 9d53457e599623fbad90833c3448835b42d7e7f9 (diff) | |
download | cpython-4267be6478d38445b8632e678e3cf459490bed6b.zip cpython-4267be6478d38445b8632e678e3cf459490bed6b.tar.gz cpython-4267be6478d38445b8632e678e3cf459490bed6b.tar.bz2 |
Multi-arg form for set.difference() and set.difference_update().
Diffstat (limited to 'Lib/test/test_set.py')
-rw-r--r-- | Lib/test/test_set.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Lib/test/test_set.py b/Lib/test/test_set.py index b32d953..1b01954 100644 --- a/Lib/test/test_set.py +++ b/Lib/test/test_set.py @@ -149,6 +149,8 @@ class TestJointOps(unittest.TestCase): self.assertEqual(self.thetype('abcba').difference(C('efgfe')), set('abc')) self.assertEqual(self.thetype('abcba').difference(C('ccb')), set('a')) self.assertEqual(self.thetype('abcba').difference(C('ef')), set('abc')) + self.assertEqual(self.thetype('abcba').difference(), set('abc')) + self.assertEqual(self.thetype('abcba').difference(C('a'), C('b')), set('c')) def test_sub(self): i = self.s.difference(self.otherword) @@ -467,6 +469,18 @@ class TestSet(TestJointOps): self.assertEqual(s.difference_update(C(p)), None) self.assertEqual(s, set(q)) + s = self.thetype('abcdefghih') + s.difference_update() + self.assertEqual(s, self.thetype('abcdefghih')) + + s = self.thetype('abcdefghih') + s.difference_update(C('aba')) + self.assertEqual(s, self.thetype('cdefghih')) + + s = self.thetype('abcdefghih') + s.difference_update(C('cdc'), C('aba')) + self.assertEqual(s, self.thetype('efghih')) + def test_isub(self): self.s -= set(self.otherword) for c in (self.word + self.otherword): |