mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
#4069: aSet.remove(otherSet) would always report the empty frozenset([]) as the missing key.
Now it correctly refers to the initial otherSet. Backport of r66836.
This commit is contained in:
parent
001befaadc
commit
00c94edea0
3 changed files with 23 additions and 4 deletions
|
@ -382,6 +382,17 @@ class TestSet(TestJointOps):
|
|||
else:
|
||||
self.fail()
|
||||
|
||||
def test_remove_keyerror_set(self):
|
||||
key = self.thetype([3, 4])
|
||||
try:
|
||||
self.s.remove(key)
|
||||
except KeyError as e:
|
||||
self.assert_(e.args[0] is key,
|
||||
"KeyError should be {0}, not {1}".format(key,
|
||||
e.args[0]))
|
||||
else:
|
||||
self.fail()
|
||||
|
||||
def test_discard(self):
|
||||
self.s.discard('a')
|
||||
self.assert_('a' not in self.s)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue