mirror of
https://github.com/python/cpython.git
synced 2025-11-01 06:01:29 +00:00
Let set.union() and set.update() accept multiple inputs.
This commit is contained in:
parent
ecbdd2e9b0
commit
ee4bcad68e
4 changed files with 65 additions and 27 deletions
|
|
@ -78,6 +78,7 @@ def test_union(self):
|
|||
self.assertEqual(self.thetype('abcba').union(C('efgfe')), set('abcefg'))
|
||||
self.assertEqual(self.thetype('abcba').union(C('ccb')), set('abc'))
|
||||
self.assertEqual(self.thetype('abcba').union(C('ef')), set('abcef'))
|
||||
self.assertEqual(self.thetype('abcba').union(C('ef'), C('fg')), set('abcefg'))
|
||||
|
||||
def test_or(self):
|
||||
i = self.s.union(self.otherword)
|
||||
|
|
@ -401,6 +402,12 @@ def test_update(self):
|
|||
s = self.thetype('abcba')
|
||||
self.assertEqual(s.update(C(p)), None)
|
||||
self.assertEqual(s, set(q))
|
||||
for p in ('cdc', 'efgfe', 'ccb', 'ef', 'abcda'):
|
||||
q = 'ahi'
|
||||
for C in set, frozenset, dict.fromkeys, str, unicode, list, tuple:
|
||||
s = self.thetype('abcba')
|
||||
self.assertEqual(s.update(C(p), C(q)), None)
|
||||
self.assertEqual(s, set(s) | set(p) | set(q))
|
||||
|
||||
def test_ior(self):
|
||||
self.s |= set(self.otherword)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue