[issue28135] assertRaises should return the exception in its simple form

2016-09-13 Thread Facundo Batista
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(Val

[issue28135] assertRaises should return the exception in its simple form

2016-09-14 Thread Raymond Hettinger
Raymond Hettinger added the comment: -0 This doesn't feel Pythonic to me. -- nosy: +rhettinger ___ Python tracker ___ ___ Python-bugs-

[issue28135] assertRaises should return the exception in its simple form

2016-09-14 Thread R. David Murray
R. David Murray added the comment: This has been proposed and rejected several times before. IMO, a strong reason to reject it is that no other assert methods return values. Consistency is important. Also note that cm survives the context manager, so you don't need that assignment statement.