diff options
| author | Brett Cannon <bcannon@gmail.com> | 2009-02-27 03:38:28 (GMT) |
|---|---|---|
| committer | Brett Cannon <bcannon@gmail.com> | 2009-02-27 03:38:28 (GMT) |
| commit | ac10be365e5c25f2bedac75b3269a22f361d51e5 (patch) | |
| tree | 59d835862ccff2cfb6e4192e15e3f015f8266239 /Lib/test/test_importlib.py | |
| parent | 75a4fab6a4f248ea5129fdab847dec77c272fddd (diff) | |
| download | cpython-ac10be365e5c25f2bedac75b3269a22f361d51e5.zip cpython-ac10be365e5c25f2bedac75b3269a22f361d51e5.tar.gz cpython-ac10be365e5c25f2bedac75b3269a22f361d51e5.tar.bz2 | |
Fix a bug where code was trying to index an int. Left over from the situation
from using str.rpartition to str.rindex.
Closes Issue5213.
Diffstat (limited to 'Lib/test/test_importlib.py')
| -rw-r--r-- | Lib/test/test_importlib.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Lib/test/test_importlib.py b/Lib/test/test_importlib.py index 572b1f1..73bb654 100644 --- a/Lib/test/test_importlib.py +++ b/Lib/test/test_importlib.py @@ -140,11 +140,14 @@ class ImportModuleTests(unittest.TestCase): pkg_name = 'pkg' pkg_long_name = '{0}.__init__'.format(pkg_name) module_name = 'mod' + subpkg_name = '{0}.subpkg'.format(pkg_name) + subpkg_long_name = '{0}.__init__'.format(subpkg_name) absolute_name = '{0}.{1}'.format(pkg_name, module_name) - relative_name = '.{0}'.format(module_name) - with mock_modules(pkg_long_name, absolute_name) as mock: + relative_name = '..{0}'.format(module_name) + with mock_modules(pkg_long_name, subpkg_long_name, + absolute_name) as mock: with import_state(meta_path=[mock]): - module = importlib.import_module(relative_name, pkg_name) + module = importlib.import_module(relative_name, subpkg_name) self.assertEqual(module.__name__, absolute_name) def test_absolute_import_with_package(self): |
