Python unittests


/ Published in: Python
Save to your folder(s)



Copy this code and paste it in your HTML
  1. import unittest
  2.  
  3. class TestSequenceFunctions(unittest.TestCase):
  4.  
  5. def setUp(self): pass
  6. def tearDown(self): pass
  7.  
  8. def test_assert(self):
  9. self.assert_( 1==1 )
  10.  
  11. def test_exceptions(self):
  12. self.assertRaises( ZeroDivisionError, lambda: 12/0 )
  13.  
  14. if __name__ == "__main__":
  15. unittest.main()

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.