mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
Extend temporary hashability to remove() and discard().
Brings the functionality back in line with sets.py.
This commit is contained in:
parent
5a5b243043
commit
bfd334a42d
2 changed files with 62 additions and 11 deletions
|
@ -182,12 +182,22 @@ class TestSet(TestJointOps):
|
|||
self.assert_('a' not in self.s)
|
||||
self.assertRaises(KeyError, self.s.remove, 'Q')
|
||||
self.assertRaises(TypeError, self.s.remove, [])
|
||||
s = self.thetype([frozenset(self.word)])
|
||||
self.assert_(self.thetype(self.word) in s)
|
||||
s.remove(self.thetype(self.word))
|
||||
self.assert_(self.thetype(self.word) not in s)
|
||||
self.assertRaises(KeyError, self.s.remove, self.thetype(self.word))
|
||||
|
||||
def test_discard(self):
|
||||
self.s.discard('a')
|
||||
self.assert_('a' not in self.s)
|
||||
self.s.discard('Q')
|
||||
self.assertRaises(TypeError, self.s.discard, [])
|
||||
s = self.thetype([frozenset(self.word)])
|
||||
self.assert_(self.thetype(self.word) in s)
|
||||
s.discard(self.thetype(self.word))
|
||||
self.assert_(self.thetype(self.word) not in s)
|
||||
s.discard(self.thetype(self.word))
|
||||
|
||||
def test_pop(self):
|
||||
for i in xrange(len(self.s)):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue