# Testing importing of built-in submodules import test.test_support, unittest import sys class BuiltinSubmoduleImportTest(unittest.TestCase): def test_import(self): self.assertIn("xxsubtype.xxsubmoduletest", sys.builtin_module_names) import xxsubtype.xxsubmoduletest import xxsubtype.xxsubmoduletest as a from xxsubtype import xxsubmoduletest as b self.assertIs(xxsubtype.xxsubmoduletest, a) self.assertIs(xxsubtype.xxsubmoduletest, b) self.assertIn(sys.modules, "xxsubtype") self.assertIn(sys.modules, "xxsubtype.xxsubmoduletest") self.assertEqual(sys.modules["xxsubtype"], xxsubtype) self.assertEqual(sys.modules["xxsubtype.xxsubmoduletest"], xxsubtype.xxsubmoduletest) self.assertTrue(hasattr(xxsubtype, "__path__")) def test_main(): test.test_support.run_unittest(BuiltinSubmoduleImportTest) if __name__ == "__main__": test_main()