Skip to content

Commit 453074c

Browse files
authored
Fix broken test for MutableSet.pop() (GH-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.
1 parent 3f3d82b commit 453074c

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
@@ -1512,8 +1512,12 @@ def discard(self,v):
15121512
return result
15131513
def __repr__(self):
15141514
return "MySet(%s)" % repr(list(self))
1515-
s = MySet([5,43,2,1])
1516-
self.assertEqual(s.pop(), 1)
1515+
items = [5,43,2,1]
1516+
s = MySet(items)
1517+
r = s.pop()
1518+
self.assertEquals(len(s), len(items) - 1)
1519+
self.assertNotIn(r, s)
1520+
self.assertIn(r, items)
15171521

15181522
def test_issue8750(self):
15191523
empty = WithSet()

0 commit comments

Comments
 (0)