test_import.py 797 B

123456789101112131415161718192021222324252627282930
  1. import unittest
  2. import sys
  3. class ImportDottedNamesTest(unittest.TestCase):
  4. def test_dotted_fromname(self):
  5. from unittest.gui import TestCaseGui
  6. self.assertTrue(TestCaseGui is not None)
  7. class ImportFromModulesTest(unittest.TestCase):
  8. def test_from_submodule(self):
  9. # Try to delete the module from the internal module list
  10. # sys.modules is a reference on Sk.sysmodules
  11. # Should allow a fresh import -> testing the intended feature
  12. try:
  13. del sys.modules["unittest"]
  14. except:
  15. pass
  16. try:
  17. del sys.modules["unittest.gui"]
  18. except:
  19. pass
  20. from unittest import gui as mystuff
  21. self.assertTrue(mystuff is not None)
  22. if __name__ == '__main__':
  23. unittest.main()