summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_importlib
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2015-05-29 22:10:30 (GMT)
committerBenjamin Peterson <benjamin@python.org>2015-05-29 22:10:30 (GMT)
commite20056c8f71a8e289016c0cbd5adb5826cd91f64 (patch)
tree3bdccf6b3978fc4c989e136093e6cff999d01785 /Lib/test/test_importlib
parenta663121e10265bb4d05b715a262cb4c1d79da082 (diff)
downloadcpython-e20056c8f71a8e289016c0cbd5adb5826cd91f64.zip
cpython-e20056c8f71a8e289016c0cbd5adb5826cd91f64.tar.gz
cpython-e20056c8f71a8e289016c0cbd5adb5826cd91f64.tar.bz2
fix importing one char extension modules (closes #24328)
Diffstat (limited to 'Lib/test/test_importlib')
-rw-r--r--Lib/test/test_importlib/extension/test_loader.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_importlib/extension/test_loader.py b/Lib/test/test_importlib/extension/test_loader.py
index 5813ade..d82c805 100644
--- a/Lib/test/test_importlib/extension/test_loader.py
+++ b/Lib/test/test_importlib/extension/test_loader.py
@@ -177,6 +177,14 @@ class MultiPhaseExtensionModuleTests(abc.LoaderTests):
self.assertEqual(module.__name__, 'pkg.' + self.name)
self.assertEqual(module.str_const, 'something different')
+ def test_load_short_name(self):
+ '''Test loading module with a one-character name'''
+ module = self.load_module_by_name('x')
+ self.assertIsInstance(module, types.ModuleType)
+ self.assertEqual(module.__name__, 'x')
+ self.assertEqual(module.str_const, 'something different')
+ assert 'x' not in sys.modules
+
def test_load_twice(self):
'''Test that 2 loads result in 2 module objects'''
module1 = self.load_module_by_name(self.name)