5 ms·
I've hit this too, it would be really nice if AssertError didn't inherit from Exception. There's a whole Exception object hierarchy but it seems like none of th
by ketralnis 11y ago
I've hit this too, it would be really nice if AssertError didn't inherit from Exception. There's a whole Exception object hierarchy but it seems like none of the parents of Exception are actually useable for anything
- dllthomas 11y agoThat would partially solve this problem (it's far rarer to see bare excepts or `except BaseException`), but could cause others. The question there should be what is (or should be) intended when someone says `except Exception` - it's not clear to me whether that should or should not include AssertionError. A more direct solution might be to have a means of storing off every assertion failure into a (clearable) list. The test harness could then check that list at the end of each test. If a particular test should succeed after triggering an assertion failure, it can check the list to make sure it triggered exactly the expected failures and then clear it.
- ketralnis 11y ago> The question there should be what is (or should be) intended when someone says `except Exception` - it's not clear to me whether that should or should not include AssertionError Right, I guess I'm not suggesting changing the language today to do this. Rather, I'm suggesting that it would be better if it were already done that way from the beginning. If it were designed that way from the start then there would be no question about the intention because it would just be part of the definition of Exception
- dllthomas 11y ago"If it were designed that way from the start then there would be no question about the intention because it would just be part of the definition of Exception" Heh, doesn't that argument apply currently? I think I was trying to ask, "when someone fails to think deeply enough about it, what is likely to give the 'correct' results"?
- masklinn 11y agoA similar issue exists for StopIteration.