diff options
Diffstat (limited to 'Doc/library')
-rw-r--r-- | Doc/library/unittest.rst | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/Doc/library/unittest.rst b/Doc/library/unittest.rst index 0aa55a6..fb5bb86 100644 --- a/Doc/library/unittest.rst +++ b/Doc/library/unittest.rst @@ -672,13 +672,15 @@ Test cases To catch any of a group of exceptions, a tuple containing the exception classes may be passed as *exception*. - .. versionchanged:: 2.7 + If *callable* is omitted or None, returns a context manager so that the + code under test can be written inline rather than as a function:: + + with self.failUnlessRaises(some_error_class): + do_something() - If *callable* is omitted or None, returns a context manager so that the - code under test can be written inline rather than as a function:: + .. versionchanged:: 2.7 + Added the ability to use :meth:`assertRaises` as a context manager. - with self.failUnlessRaises(some_error_class): - do_something() .. method:: failIf(expr[, msg]) assertFalse(expr[, msg]) |