Message276334
| Author |
facundobatista |
| Recipients |
facundobatista |
| Date |
2016年09月13日.20:12:11 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1473797531.08.0.417014131559.issue28135@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
So, you could do:
exc = self.assertRaises(ValueError, somefunc, someargs)
And then, explore "exc" as will.
Yes, you can get the exception if you use assertRaises as a context manager, but that leads to more cumbersome code:
with self.assertRaises(ValueError) as cm:
somefunc(someargs)
exc = cm.exception |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2016年09月13日 20:12:11 | facundobatista | set | recipients:
+ facundobatista |
| 2016年09月13日 20:12:11 | facundobatista | set | messageid: <1473797531.08.0.417014131559.issue28135@psf.upfronthosting.co.za> |
| 2016年09月13日 20:12:11 | facundobatista | link | issue28135 messages |
| 2016年09月13日 20:12:11 | facundobatista | create |
|