mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
Issue 8750: Fixed MutableSet's methods to correctly handle reflexive operations, namely x -= x and x ^= x
This commit is contained in:
parent
d8e5f2df68
commit
31da5b2f69
3 changed files with 33 additions and 9 deletions
|
@ -526,6 +526,21 @@ class TestCollectionABCs(ABCTestCase):
|
|||
s = MySet([5,43,2,1])
|
||||
self.assertEqual(s.pop(), 1)
|
||||
|
||||
def test_issue8750(self):
|
||||
empty = WithSet()
|
||||
full = WithSet(range(10))
|
||||
s = WithSet(full)
|
||||
s -= s
|
||||
self.assertEqual(s, empty)
|
||||
s = WithSet(full)
|
||||
s ^= s
|
||||
self.assertEqual(s, empty)
|
||||
s = WithSet(full)
|
||||
s &= s
|
||||
self.assertEqual(s, full)
|
||||
s |= s
|
||||
self.assertEqual(s, full)
|
||||
|
||||
def test_Mapping(self):
|
||||
for sample in [dict]:
|
||||
self.assertIsInstance(sample(), Mapping)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue