J
john
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
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