def assertRaisesRegexp(self, expected_exception, expected_regexp,<EOL>callable_obj=None, *args, **kwargs):
if callable_obj is None:<EOL><INDENT>return _AssertRaisesContext(expected_exception, self, expected_regexp)<EOL><DEDENT>try:<EOL><INDENT>callable_obj(*args, **kwargs)<EOL><DEDENT>except expected_exception as exc_value:<EOL><INDENT>if isinstance(expected_regexp, str):<EOL><INDENT>expected_regexp = re.compile(expected_regexp)<EOL><DEDENT>if not expected_regexp.search(str(exc_value)):<EOL><INDENT>raise self.failureException('<STR_LIT>' %<EOL>(expected_regexp.pattern, str(exc_value)))<EOL><DEDENT><DEDENT>else:<EOL><INDENT>if hasattr(expected_exception, '<STR_LIT>'): <EOL><INDENT>excName = expected_exception.__name__<EOL><DEDENT>else: <EOL><INDENT>excName = str(expected_exception)<EOL><DEDENT>raise self.failureException("<STR_LIT>" % excName)<EOL><DEDENT>
Asserts that the message in a raised exception matches a regexp.

        Args:
            expected_exception: Exception class expected to be raised.
            expected_regexp: Regexp (re pattern object or string) expected
                    to be found in error message.
            callable_obj: Function to be called.
            args: Extra args.
            kwargs: Extra kwargs.