Re: [Pyunit-interest] Assert that an Exception is NOT raised.
Brought to you by:
purcell
From: Noah S. <no...@no...> - 2002-12-11 15:02:44
|
I'm not sure if I read your question right, but the follow code is what I use to test for an exception NOT being raised. class MissingExceptionTestCase (unittest.TestCase): def testMissingException (self): try: do_something_stupid_that_should_raise_an_exception () except Exception: pass else: self.fail ('An Exception was expected, but it was not raised. This is bad.') Yours, Noah ----- Original Message ----- From: "Timothy Grant" <tj...@cr...> To: <pyu...@li...> Sent: Tuesday, December 10, 2002 10:07 PM Subject: [Pyunit-interest] Assert that an Exception is NOT raised. |