Kaydet (Commit) e5b25df1 authored tarafından Brett Cannon's avatar Brett Cannon

Issue #15767: Add an explicit test for raising ModuleNotFoundError

when None in sys.modules.
üst 8f5ac510
......@@ -26,6 +26,13 @@ class APITest(unittest.TestCase):
with self.assertRaises(ModuleNotFoundError):
util.import_('some module that does not exist')
def test_raises_ModuleNotFoundError_for_None(self):
# None in sys.modules should raise ModuleNotFoundError.
with importlib_test_util.uncache('not_here'):
sys.modules['not_here'] = None
with self.assertRaises(ModuleNotFoundError):
util.import_('not_here')
def test_name_requires_rparition(self):
# Raise TypeError if a non-string is passed in for the module name.
with self.assertRaises(TypeError):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment