Kristján Valur Jónsson <[email protected]> added the comment:
Pehaps it hasn't been demonstrated before, but just for the sake of argument
(and because I'm a persistant bugger), here are the two different cases:
current:
ctxt = self.assertRaises(MyException)
with ctxt:
foo()
self.assertEqual(ctxt.exception.value, 1)
suggested:
e = self.assertRaises(MyExcetpion, foo)
self.assertEqual(e.value, 1)
The inconvenient bit about the current method is having to keep the context
manager around. Also note that the current way of looking at the exception
object makes it blatantly clear that self.assertRaises() is returning an
object. That, imho, breaks the argument about self.assert* methods not
returning any info.
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue9587>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com