]>
Commit | Line | Data |
---|---|---|
1 | #!/usr/bin/env python | |
2 | ||
3 | __author__ = "Patrick K. O'Brien <pobrien@orbtech.com>" | |
4 | __cvsid__ = "$Id$" | |
5 | __revision__ = "$Revision$"[11:-2] | |
6 | ||
7 | import unittest | |
8 | ||
9 | # Import from this module's parent directory. | |
10 | import os | |
11 | import sys | |
12 | sys.path.insert(0, os.pardir) | |
13 | import pseudo | |
14 | del sys.path[0] | |
15 | del sys | |
16 | del os | |
17 | ||
18 | ||
19 | """ | |
20 | These unittest methods are preferred: | |
21 | ------------------------------------- | |
22 | self.assert_(expr, msg=None) | |
23 | self.assertEqual(first, second, msg=None) | |
24 | self.assertRaises(excClass, callableObj, *args, **kwargs) | |
25 | self.fail(msg=None) | |
26 | self.failIf(expr, msg=None) | |
27 | """ | |
28 | ||
29 | ||
30 | class ModuleTestCase(unittest.TestCase): | |
31 | ||
32 | def test_module(self): | |
33 | module = pseudo | |
34 | self.assert_(module.__author__) | |
35 | self.assert_(module.__cvsid__) | |
36 | self.assert_(module.__revision__) | |
37 | self.assert_(module.PseudoFile) | |
38 | self.assert_(module.PseudoFileErr) | |
39 | self.assert_(module.PseudoFileIn) | |
40 | self.assert_(module.PseudoFileOut) | |
41 | self.assert_(module.PseudoKeyword) | |
42 | ||
43 | ||
44 | class PseudoTestCase(unittest.TestCase): | |
45 | ||
46 | def setUp(self): | |
47 | pass | |
48 | ||
49 | def tearDown(self): | |
50 | pass | |
51 | ||
52 | ||
53 | class PseudoFileTestCase(unittest.TestCase): | |
54 | ||
55 | def setUp(self): | |
56 | pass | |
57 | ||
58 | def tearDown(self): | |
59 | pass | |
60 | ||
61 | ||
62 | class PseudoFileOutTestCase(unittest.TestCase): | |
63 | ||
64 | def setUp(self): | |
65 | pass | |
66 | ||
67 | def tearDown(self): | |
68 | pass | |
69 | ||
70 | def _write(self): | |
71 | pass | |
72 | ||
73 | def test_PseudoFileOut_goodInit(self): | |
74 | self.assert_(pseudo.PseudoFileOut(write=self._write)) | |
75 | ||
76 | def test_PseudoFileOut_badInit(self): | |
77 | self.assertRaises(ValueError, pseudo.PseudoFileOut, write='bad') | |
78 | ||
79 | ||
80 | if __name__ == '__main__': | |
81 | unittest.main() |