def METHOD_NAME(recwarn):
    def add(x, y):
        """Add x and y."""
        return x + y
    do_plus = legacy_alias(add, "do_plus", since="v1.2")
    assert add.__doc__ == "Add x and y."
    assert do_plus.__doc__ == (
        "\n"
        ".. deprecated:: v1.2\n"
        "   Usage of this legacy function is deprecated. Use :py:func:`.add`\n"
        "   instead.\n"
    )
    assert add(2, 3) == 5
    assert len(recwarn) == 0
    with pytest.warns(
        UserDeprecationWarning,
        match=re.escape(
            "Call to deprecated function (or staticmethod) add."
            " (Usage of this legacy function is deprecated. Use `.add` instead.)"
            " -- Deprecated since version v1.2."
        ),
    ):
        res = do_plus(2, 3)
    assert res == 5