def METHOD_NAME(self, tol, r_dtype, mocker, shots):
    """Test that the expval interface works"""
    dev = qml.device("default.qubit.legacy", wires=2, shots=shots)
    dev.R_DTYPE = r_dtype
    @qml.qnode(dev, diff_method="parameter-shift")
    def circuit(x):
        qml.RX(x, wires=0)
        return qml.expval(qml.PauliY(0))
    new_dev = circuit.device
    spy = mocker.spy(qml.QubitDevice, "expval")
    x = 0.54
    res = circuit(x)
    expected = -np.sin(x)
    atol = tol if shots is None else 0.05
    rtol = 0 if shots is None else 0.05
    assert np.allclose(res, expected, atol=atol, rtol=rtol)
    # pylint: disable=no-member, unsubscriptable-object
    if isinstance(res, tuple):
        assert res[0].dtype == r_dtype
        assert res[1].dtype == r_dtype
    else:
        assert res.dtype == r_dtype
    custom_measurement_process(new_dev, spy)