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