cpython: c6c0faaf65d7 (original) (raw)
Mercurial > cpython
changeset 84110:c6c0faaf65d7
Issue #15767: Add an explicit test for raising ModuleNotFoundError when None in sys.modules. [#15767]
Brett Cannon brett@python.org | |
---|---|
date | Wed, 12 Jun 2013 23:38:50 -0400 |
parents | 3a50025f1900 |
children | 00a199c265c3 3b906421245d |
files | Lib/test/test_importlib/import_/test_api.py |
diffstat | 1 files changed, 7 insertions(+), 0 deletions(-)[+] [-] Lib/test/test_importlib/import_/test_api.py 7 |
line wrap: on
line diff
--- a/Lib/test/test_importlib/import_/test_api.py +++ b/Lib/test/test_importlib/import_/test_api.py @@ -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.[](#l1.8)
with importlib_test_util.uncache('not_here'):[](#l1.9)
sys.modules['not_here'] = None[](#l1.10)
with self.assertRaises(ModuleNotFoundError):[](#l1.11)
util.import_('not_here')[](#l1.12)
+ def test_name_requires_rparition(self): # Raise TypeError if a non-string is passed in for the module name. with self.assertRaises(TypeError):