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): raise ValueError This saves having to put exception raising tests into a try/except block, which is cool. And by cool I mean totally sweet. ---------- components: Library (Lib) files: unittest.patch keywords: patch messages: 76492 nosy: dleonard0 severity: normal status: open title: unittest - use contexts to assert exceptions type: feature request versions: Python 3.0 Added file: http://bugs.python.org/file12138/unittest.patch _______________________________________ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue4444> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com