This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author steven.daprano
Recipients bar.harel, ezio.melotti, michael.foord, rbcollins, steven.daprano
Date 2016-06-01.15:10:28
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Yes. What does such an assertion actually mean?

Why would I write `self.assertNotRaises(ValueError, spam, arg)` rather than just call `spam(arg)`? The only difference is that assertNotRaises will treat one specific exception as a test failure rather than a error, but I don't think that's useful. spam(arg) presumably is supposed to return something, or do something, not merely "don't raise ValueError". Raising ValueError should be no different from raising any other exception: it's a error, not a failure.

It makes sense to test for expected exceptions. I don't think it makes sense to test for exceptions that don't happen. Every single successful test of `spam(arg)` shows that ValueError is not raised, as well as every imaginable other exception. I don't think there is any need for an assert method to test for exceptions not being raised.
Date User Action Args
2016-06-01 15:10:28steven.dapranosetrecipients: + steven.daprano, rbcollins, ezio.melotti, michael.foord, bar.harel
2016-06-01 15:10:28steven.dapranosetmessageid: <>
2016-06-01 15:10:28steven.dapranolinkissue27176 messages
2016-06-01 15:10:28steven.dapranocreate