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