'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.'

def assertRaisesRegexp(self, expected_exception, expected_regexp, callable_obj=None, *args, **kwargs):

    if (expected_regexp is not None):
        expected_regexp = re.compile(expected_regexp)
    context = _AssertRaisesContext(expected_exception, self, expected_regexp)
    if (callable_obj is None):
        return context
    with context:
        callable_obj(*args, **kwargs)
