Skip to content

Commit

Permalink
Fix broken test for MutableSet.pop() (pythonGH-25209)
Browse files Browse the repository at this point in the history
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 <me@stevesindelar.cz>
  • Loading branch information
steve-s authored and miss-islington committed Apr 7, 2021
1 parent 4554ab4 commit 974d7ad
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Lib/test/test_collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -1423,8 +1423,12 @@ def discard(self,v):
return result
def __repr__(self):
return "MySet(%s)" % repr(list(self))
s = MySet([5,43,2,1])
self.assertEqual(s.pop(), 1)
items = [5,43,2,1]
s = MySet(items)
r = s.pop()
self.assertEquals(len(s), len(items) - 1)
self.assertNotIn(r, s)
self.assertIn(r, items)

def test_issue8750(self):
empty = WithSet()
Expand Down

0 comments on commit 974d7ad

Please sign in to comment.