rendered paste body# wtf.py
#!/usr/bin/python
def foo():
raise ValueError
# test_wtf.py
#!/usr/bin/python
from wtf import foo
import unittest
class Test(unittest.TestCase):
def test(self):
self.assertRaises(self, ValueError, foo())
if __name__ == '__main__': unittest.main()
# output:cmd@cabbage ~/tmp $ ./test_wtf.py
E
======================================================================
ERROR: test (__main__.Test)
----------------------------------------------------------------------
Traceback (most recent call last):
File "./test_wtf.py", line 7, in test
self.assertRaises(self, ValueError, foo())
File "/home/cmd/tmp/wtf.py", line 4, in foo
raise ValueError
ValueError
----------------------------------------------------------------------
Ran 1 test in 0.001s
FAILED (errors=1)