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

Method test_conversion_bad

Lib/test/test_capi/test_misc.py:2323–2344  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2321 self.assertEqual(converted, interpid)
2322
2323 def test_conversion_bad(self):
2324 convert = _testinternalcapi.normalize_interp_id
2325
2326 for badid in [
2327 object(),
2328 10.0,
2329 '10',
2330 b'10',
2331 ]:
2332 with self.subTest(f'bad: {badid!r}'):
2333 with self.assertRaises(TypeError):
2334 convert(badid)
2335
2336 badid = -1
2337 with self.subTest(f'bad: {badid!r}'):
2338 with self.assertRaises(ValueError):
2339 convert(badid)
2340
2341 badid = 2**64
2342 with self.subTest(f'bad: {badid!r}'):
2343 with self.assertRaises(OverflowError):
2344 convert(badid)
2345
2346 def test_lookup_exists(self):
2347 interpid = self.new_interpreter()

Callers

nothing calls this directly

Calls 3

convertFunction · 0.50
subTestMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected