From 5e66f744fa12beba381bceff00bcc8e892ed6c76 Mon Sep 17 00:00:00 2001 From: Stepan Sindelar Date: Thu, 8 Apr 2021 01:31:55 +0200 Subject: [PATCH] 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. (cherry picked from commit 453074c8daf996b1815a0cd2218f0dbf1801056c) Co-authored-by: Stepan Sindelar --- Lib/test/test_collections.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_collections.py b/Lib/test/test_collections.py index 3ff660cf7a37be3..6a819358fe89f54 100644 --- a/Lib/test/test_collections.py +++ b/Lib/test/test_collections.py @@ -1502,8 +1502,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()