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

Method test_importmoduleex

Lib/test/test_capi/test_import.py:177–185  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

175 self.assertEqual(importfrozenmoduleobject(NULL), 0)
176
177 def test_importmoduleex(self):
178 # Test PyImport_ImportModuleEx()
179 importmoduleex = _testlimitedcapi.PyImport_ImportModuleEx
180 self.check_import_func(lambda name: importmoduleex(name, NULL, NULL, NULL))
181
182 self.assertRaises(ModuleNotFoundError, importmoduleex, 'nonexistent', NULL, NULL, NULL)
183 self.assertRaises(ValueError, importmoduleex, '', NULL, NULL, NULL)
184 self.assertRaises(UnicodeDecodeError, importmoduleex, b'\xff', NULL, NULL, NULL)
185 # CRASHES importmoduleex(NULL, NULL, NULL, NULL)
186
187 def check_importmodulelevel(self, importmodulelevel):
188 self.check_import_func(lambda name: importmodulelevel(name, NULL, NULL, NULL, 0))

Callers

nothing calls this directly

Calls 2

check_import_funcMethod · 0.95
assertRaisesMethod · 0.45

Tested by

no test coverage detected