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

Method test_newempty

Lib/test/test_code.py:254–262  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

252
253 @cpython_only
254 def test_newempty(self):
255 _testcapi = import_helper.import_module("_testcapi")
256 co = _testcapi.code_newempty("filename", "funcname", 15)
257 self.assertEqual(co.co_filename, "filename")
258 self.assertEqual(co.co_name, "funcname")
259 self.assertEqual(co.co_firstlineno, 15)
260 #Empty code object should raise, but not crash the VM
261 with self.assertRaises(Exception):
262 exec(co)
263
264 @cpython_only
265 def test_closure_injection(self):

Callers

nothing calls this directly

Calls 3

import_moduleMethod · 0.45
assertEqualMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected