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 <rep...@bugs.python.org>
<http://bugs.python.org/issue28135>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to