[issue4444] unittest - use contexts to assert exceptions

2008-12-28 Thread Antoine Pitrou
Antoine Pitrou added the comment: I've committed an improved patch, with tests and doc, in r67979 and r67981. Thanks! -- resolution: -> fixed status: open -> closed ___ Python tracker _

[issue4444] unittest - use contexts to assert exceptions

2008-12-27 Thread Antoine Pitrou
Changes by Antoine Pitrou : -- nosy: +pitrou ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.

[issue4444] unittest - use contexts to assert exceptions

2008-11-27 Thread Steve Purcell
Steve Purcell <[EMAIL PROTECTED]> added the comment: I like this change, since assertRaises can be a bit messy when passing it a local function. I'd suggest modifying the patch such that the AssertRaisesContext class is also used when callableObj is provided, which would eliminate the duplic

[issue4444] unittest - use contexts to assert exceptions

2008-11-27 Thread David Leonard
New submission from David Leonard <[EMAIL PROTECTED]>: Patch to allow unit tests to test for exceptions through a 'with' statement. Resulting (failing) test would look like this: import unittest class T(unittest.TestCase): def runTest(self): with self.assertRaises(KeyError):