[New-bugs-announce] [issue28135] assertRaises should return the exception in its simple form

Facundo Batista report at bugs.python.org
Tue Sep 13 16:12:11 EDT 2016


New submission from Facundo Batista:

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

----------
messages: 276334
nosy: facundobatista
priority: normal
severity: normal
status: open
title: assertRaises should return the exception in its simple form

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue28135>
_______________________________________


More information about the New-bugs-announce mailing list