def assertRaises(self, excClass, callableObj=None, *args, **kwargs):
if callableObj is None:<EOL><INDENT>return _AssertRaisesContext(excClass, self)<EOL><DEDENT>try:<EOL><INDENT>callableObj(*args, **kwargs)<EOL><DEDENT>except excClass:<EOL><INDENT>return<EOL><DEDENT>if hasattr(excClass,'<STR_LIT>'):<EOL><INDENT>excName = excClass.__name__<EOL><DEDENT>else:<EOL><INDENT>excName = str(excClass)<EOL><DEDENT>raise self.failureException("<STR_LIT>" % excName)<EOL>
Fail unless an exception of class excClass is thrown
           by callableObj when invoked with arguments args and keyword
           arguments kwargs. If a different type of exception is
           thrown, it will not be caught, and the test case will be
           deemed to have suffered an error, exactly as for an
           unexpected exception.

           If called with callableObj omitted or None, will return a
           context object used like this::

                with self.assertRaises(SomeException):
                    do_something()

           The context manager keeps a reference to the exception as
           the 'exception' attribute. This allows you to inspect the
           exception after the assertion::

               with self.assertRaises(SomeException) as cm:
                   do_something()
               the_exception = cm.exception
               self.assertEqual(the_exception.error_code, 3)