]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/wx/py/tests/test_interpreter.py
3 __author__
= "Patrick K. O'Brien <pobrien@orbtech.com>"
5 __revision__
= "$Revision$"[11:-2]
9 # Import from this module's parent directory.
12 sys
.path
.insert(0, os
.pardir
)
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)
26 self.failIf(expr, msg=None)
30 class ModuleTestCase(unittest
.TestCase
):
32 def test_module(self
):
34 self
.assert_(module
.__author
__)
35 self
.assert_(module
.__cvsid
__)
36 self
.assert_(module
.__revision
__)
37 self
.assert_(module
.Interpreter
)
38 self
.assert_(module
.Interpreter
.push
)
39 self
.assert_(module
.Interpreter
.runsource
)
40 self
.assert_(module
.Interpreter
.getAutoCompleteList
)
41 self
.assert_(module
.Interpreter
.getCallTip
)
42 self
.assert_(module
.InterpreterAlaCarte
)
45 class InterpreterTestCase(unittest
.TestCase
):
49 self
.i
= interpreter
.Interpreter(stdout
=self
)
51 def write(self
, text
):
52 """Capture output from self.i.push()."""
61 self
.assertEqual(self
.i
.push('dir()'), 0)
62 self
.assertEqual(self
.i
.push('for n in range(3):'), 1)
66 ('dir', '<built-in function dir>'),
67 ('dir()', "['__builtins__', '__doc__', '__name__']"),
72 ('len([4,5,6])', '3'),
74 for input, output
in values
:
75 if output
: output
+= '\n'
77 self
.assertEqual(self
.output
, output
)
81 if __name__
== '__main__':