unittest assertRaises Problem
john
puopolo at gmail.com
Mon Apr 16 18:13:42 EDT 2007
All:
Hi. I am an experienced developer (15 yrs), but new to Python and have
a question re unittest and assertRaises. No matter what I raise,
assertRaises is never successful. Here is the test code:
class Foo:
def testException(self):
raise ValueError
class FooTestCase(unittest.TestCase):
testTryThis(self):
f = Foo()
self.assertRaises(ValueError, f.testException())
This fails --- unittest reports the following:
FAILED (errors=1)
This seems like the most basic thing in the world. I am running Python
2.5 on Windows XP using Eclipse and PyDev
Any help appreciated.
Thanks,
John
More information about the Python-list
mailing list