Message169596
| 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:03 | daniel.wagner-hall | set | recipients:
+ daniel.wagner-hall |
| 2012年09月01日 00:26:01 | daniel.wagner-hall | set | messageid: <1346459161.18.0.156457463704.issue15836@psf.upfronthosting.co.za> |
| 2012年09月01日 00:25:56 | daniel.wagner-hall | link | issue15836 messages |
| 2012年09月01日 00:25:55 | daniel.wagner-hall | create |
|