diff options
Diffstat (limited to 'tests/utils_tests/test_module_loading.py')
| -rw-r--r-- | tests/utils_tests/test_module_loading.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/utils_tests/test_module_loading.py b/tests/utils_tests/test_module_loading.py index 5362c2b06b..c114d84d88 100644 --- a/tests/utils_tests/test_module_loading.py +++ b/tests/utils_tests/test_module_loading.py @@ -48,6 +48,18 @@ class DefaultLoader(unittest.TestCase): with self.assertRaises(ImportError): import_module('utils_tests.test_no_submodule.anything') + def test_has_sumbodule_with_dotted_path(self): + """Nested module existence can be tested.""" + test_module = import_module('utils_tests.test_module') + # A grandchild that exists. + self.assertIs(module_has_submodule(test_module, 'child_module.grandchild_module'), True) + # A grandchild that doesn't exist. + self.assertIs(module_has_submodule(test_module, 'child_module.no_such_module'), False) + # A grandchild whose parent doesn't exist. + self.assertIs(module_has_submodule(test_module, 'no_such_module.grandchild_module'), False) + # A grandchild whose parent is not a package. + self.assertIs(module_has_submodule(test_module, 'good_module.no_such_module'), False) + class EggLoader(unittest.TestCase): def setUp(self): |
