test_scriptpackages.py 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. # Copyright (C) 2003 Python Software Foundation
  2. import unittest
  3. from test import test_support
  4. # Skip this test if aetools does not exist.
  5. test_support.import_module('aetools')
  6. class TestScriptpackages(unittest.TestCase):
  7. def _test_scriptpackage(self, package, testobject=1):
  8. # Check that we can import the package
  9. mod = __import__(package)
  10. # Test that we can get the main event class
  11. klass = getattr(mod, package)
  12. # Test that we can instantiate that class
  13. talker = klass()
  14. if testobject:
  15. # Test that we can get an application object
  16. obj = mod.application(0)
  17. def test__builtinSuites(self):
  18. self._test_scriptpackage('_builtinSuites', testobject=0)
  19. def test_StdSuites(self):
  20. self._test_scriptpackage('StdSuites')
  21. def test_SystemEvents(self):
  22. self._test_scriptpackage('SystemEvents')
  23. def test_Finder(self):
  24. self._test_scriptpackage('Finder')
  25. def test_Terminal(self):
  26. self._test_scriptpackage('Terminal')
  27. def test_Netscape(self):
  28. self._test_scriptpackage('Netscape')
  29. def test_Explorer(self):
  30. self._test_scriptpackage('Explorer')
  31. def test_CodeWarrior(self):
  32. self._test_scriptpackage('CodeWarrior')
  33. def test_main():
  34. test_support.run_unittest(TestScriptpackages)
  35. if __name__ == '__main__':
  36. test_main()