MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_newempty

Method test_newempty

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 4

execFunction · 0.50
import_moduleMethod · 0.45
assertEqualMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected