]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Fix broken test for MutableSet.pop() (GH-25209)
authorStepan Sindelar <me@stevesindelar.cz>
Wed, 7 Apr 2021 23:31:55 +0000 (01:31 +0200)
committerGitHub <noreply@github.com>
Wed, 7 Apr 2021 23:31:55 +0000 (16:31 -0700)
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.

Lib/test/test_collections.py

index 30303f00ba5c1753e5c2c27dd4daecad88583960..7b245c08b5ddd3a97d4d319e085f62b9e3740790 100644 (file)
@@ -1512,8 +1512,12 @@ class TestCollectionABCs(ABCTestCase):
                 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()