homepage

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 daniel.wagner-hall
Recipients daniel.wagner-hall
Date 2012年09月01日.00:25:52
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1346459161.18.0.156457463704.issue15836@psf.upfronthosting.co.za>
In-reply-to
Content
The following code in a unittest test is a no-op:
self.assertRaises(lambda: 1)
I would expect this to fail the test, because I naively assumed omitting the exception class would act as:
self.assertRaises(BaseException, lambda: 1)
verifying that *any* Exception is raised.
I believe the correct behaviour is to raise a TypeError if excClass is not a BaseException-derived type, similar to if a non-type is passed as the first arg to issubclass.
Attached is a patch to do so. It also removes a no-op self.assertRaises from libimport's tests (because it started failing when I ran the tests with the patch). That assertion is redundant, because the two lines above perform the assertion being attempted.
History
Date User Action Args
2012年09月01日 00:26:03daniel.wagner-hallsetrecipients: + daniel.wagner-hall
2012年09月01日 00:26:01daniel.wagner-hallsetmessageid: <1346459161.18.0.156457463704.issue15836@psf.upfronthosting.co.za>
2012年09月01日 00:25:56daniel.wagner-halllinkissue15836 messages
2012年09月01日 00:25:55daniel.wagner-hallcreate

AltStyle によって変換されたページ (->オリジナル) /