def assert_raises_regex(_exception, _regexp, _callable=None,<EOL>*args, **kwargs):
warnings.warn(("<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"), FutureWarning, stacklevel=<NUM_LIT:2>)<EOL>manager = _AssertRaisesContextmanager(exception=_exception, regexp=_regexp)<EOL>if _callable is not None:<EOL><INDENT>with manager:<EOL><INDENT>_callable(*args, **kwargs)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>return manager<EOL><DEDENT>
r"""
    Check that the specified Exception is raised and that the error message
    matches a given regular expression pattern. This may be a regular
    expression object or a string containing a regular expression suitable
    for use by `re.search()`. This is a port of the `assertRaisesRegexp`
    function from unittest in Python 2.7.

    .. deprecated:: 0.24.0
        Use `pytest.raises` instead.

    Examples
    --------
    >>> assert_raises_regex(ValueError, 'invalid literal for.*XYZ', int, 'XYZ')
    >>> import re
    >>> assert_raises_regex(ValueError, re.compile('literal'), int, 'XYZ')

    If an exception of a different type is raised, it bubbles up.

    >>> assert_raises_regex(TypeError, 'literal', int, 'XYZ')
    Traceback (most recent call last):
        ...
    ValueError: invalid literal for int() with base 10: 'XYZ'
    >>> dct = dict()
    >>> assert_raises_regex(KeyError, 'pear', dct.__getitem__, 'apple')
    Traceback (most recent call last):
        ...
    AssertionError: "pear" does not match "'apple'"

    You can also use this in a with statement.

    >>> with assert_raises_regex(TypeError, r'unsupported operand type\(s\)'):
    ...     1 + {}
    >>> with assert_raises_regex(TypeError, 'banana'):
    ...     'apple'[0] = 'b'
    Traceback (most recent call last):
        ...
    AssertionError: "banana" does not match "'str' object does not support \
item assignment"