Message169596
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. |
|
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 | |
|