[BangPypers] unittest failing

Kenneth Gonsalves lawgon at gmail.com
Tue Mar 8 12:43:27 CET 2011


hi,

I am trying to figure out unittests on exceptions. I have a test which
should pass - but it is failing. The simplest possible code is here:

#!/usr/bin/env python
import unittest
def testfunc():
    if 1:
        raise TypeError
    
class Testfunc(unittest.TestCase):
    def testit(self):
        self.assertRaises(TypeError,testfunc())
        
if __name__ == '__main__':
    unittest.main()
-- 
regards
Kenneth Gonsalves
http://lawgon.livejournal.com/



More information about the BangPypers mailing list