mirror of
https://github.com/python/cpython.git
synced 2025-08-01 07:33:08 +00:00
Multi-arg form for set.difference() and set.difference_update().
This commit is contained in:
parent
9d53457e59
commit
4267be6478
4 changed files with 66 additions and 21 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue