A Simple Test Using the unittest Framework : unit test « Buildin Module « Python Tutorial






import unittest, my_math

class ProductTestCase(unittest.TestCase):
   def testIntegers(self):
       self.failUnless(1 == 2, 'Integer multiplication failed')

   def testFloats(self):
       self.failUnless(1.1 == 2.2, 'Float multiplication failed')

unittest.main()








14.19.unit test
14.19.1.A Simple Test Using the unittest Framework