MCPcopy Index your code
hub / github.com/python/cpython / test_pop

Method test_pop

Lib/test/test_capi/test_set.py:197–212  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

195 # CRASHES: discard(NULL, NULL)
196
197 def test_pop(self):
198 pop = _testlimitedcapi.set_pop
199 orig = (1, 2)
200 for cls in (set, set_subclass):
201 with self.subTest(cls=cls):
202 instance = cls(orig)
203 self.assertIn(pop(instance), orig)
204 self.assertEqual(len(instance), 1)
205 self.assertIn(pop(instance), orig)
206 self.assertEqual(len(instance), 0)
207 with self.assertRaises(KeyError):
208 pop(instance)
209 with self.assertRaises(SystemError):
210 pop(object())
211 self.assertImmutable(pop)
212 # CRASHES: pop(NULL)
213
214 def test_clear(self):
215 clear = _testlimitedcapi.set_clear

Callers

nothing calls this directly

Calls 6

assertInMethod · 0.80
assertImmutableMethod · 0.80
clsClass · 0.50
subTestMethod · 0.45
assertEqualMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected