Unit tests in Leo

ajikoe at gmail.com ajikoe at gmail.com
Sun Apr 10 04:53:25 EDT 2005


Hello Tomi,

I'm not really sure about your question, but concerning unit testing
you can do a simple test.

import unittest

First:  in your module (where you define functions) you should create a
class which use unittest.TestCase as your superclass.

Second: Use method runTest to type your test

Third: below the __name__ == "__main__" type unittest.main();

For example:
class testMyFunc(unittest.TestCase):
  def runTest(self):
    h = myFunc()
    self.assertEqual(something,h)
#----------------------
if __name__ == "__main__":
  unittest.main();


Sincerely Yours,
Pujo




More information about the Python-list mailing list