Skip to content

Commit 974d7ad

Browse files
steve-smiss-islington
authored andcommitted
Fix broken test for MutableSet.pop() (pythonGH-25209)
Changes the test to not assert concrete result of pop, but just that it was an item from the set, and that the set shrunk by one. (cherry picked from commit 453074c) Co-authored-by: Stepan Sindelar <[email protected]>
1 parent 4554ab4 commit 974d7ad

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Lib/test/test_collections.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1423,8 +1423,12 @@ def discard(self,v):
14231423
return result
14241424
def __repr__(self):
14251425
return "MySet(%s)" % repr(list(self))
1426-
s = MySet([5,43,2,1])
1427-
self.assertEqual(s.pop(), 1)
1426+
items = [5,43,2,1]
1427+
s = MySet(items)
1428+
r = s.pop()
1429+
self.assertEquals(len(s), len(items) - 1)
1430+
self.assertNotIn(r, s)
1431+
self.assertIn(r, items)
14281432

14291433
def test_issue8750(self):
14301434
empty = WithSet()

0 commit comments

Comments
 (0)