sillyemperor:
I was a new guy of Python,when i want to test my wxPython app by
unittest,it couldn`t work.I fund a stubmaker.py but it only for
wxDialog but all widgets.Can someone can tell me how test wxPython by
unittest?Thanks
Here's a small example to get you started:
import unittest, wx
class TextCtrlTest(un ittest.TestCase ):
def setUp(self):
app = wx.App(0)
frame = wx.Frame(None)
self.textCtrl = wx.TextCtrl(fra me)
def testInitialCont ents(self):
self.assertEqua l('', self.textCtrl.G etValue())
def testAppendText( self):
self.textCtrl.A ppendText('what ever')
self.assertEqua l('whatever', self.textCtrl.G etValue())
def testAppendTextT wice(self):
self.textCtrl.A ppendText('what ever')
self.textCtrl.A ppendText('and then some')
self.assertEqua l('whateverand then some',
self.textCtrl.G etValue())
if __name__ == '__main__':
unittest.main()
Cheers, Frank