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

Method test_clear

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

Source from the content-addressed store, hash-verified

212 # CRASHES: pop(NULL)
213
214 def test_clear(self):
215 clear = _testlimitedcapi.set_clear
216 for cls in (set, set_subclass):
217 with self.subTest(cls=cls):
218 instance = cls((1, 2))
219 self.assertEqual(clear(instance), 0)
220 self.assertEqual(instance, set())
221 self.assertEqual(clear(instance), 0)
222 self.assertEqual(instance, set())
223 with self.assertRaises(SystemError):
224 clear(object())
225 self.assertImmutable(clear)
226 # CRASHES: clear(NULL)
227
228
229class TestInternalCAPI(BaseSetTests, unittest.TestCase):

Callers

nothing calls this directly

Calls 6

setFunction · 0.85
assertImmutableMethod · 0.80
clsClass · 0.50
subTestMethod · 0.45
assertEqualMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected