def assert_raise_message(exceptions, message, function, *args, **kwargs):
try:<EOL><INDENT>function(*args, **kwargs)<EOL><DEDENT>except exceptions as e:<EOL><INDENT>error_message = str(e)<EOL>if message not in error_message:<EOL><INDENT>raise AssertionError("<STR_LIT>"<EOL>"<STR_LIT>" %<EOL>(message, error_message))<EOL><DEDENT><DEDENT>else:<EOL><INDENT>if isinstance(exceptions, tuple):<EOL><INDENT>names = "<STR_LIT>".join(e.__name__ for e in exceptions)<EOL><DEDENT>else:<EOL><INDENT>names = exceptions.__name__<EOL><DEDENT>raise AssertionError("<STR_LIT>" %<EOL>(names, function.__name__))<EOL><DEDENT>
Helper function to test error messages in exceptions
    Parameters
    ----------
    exceptions : exception or tuple of exception
        Name of the estimator
    func : callable
        Calable object to raise error
    *args : the positional arguments to `func`.
    **kw : the keyword arguments to `func`