def METHOD_NAME(device, spy):
    assert len(spy.call_args_list) > 0  # make sure method is mocked properly
    # pylint: disable=protected-access
    samples = device._samples
    state = device._state
    call_args_list = list(spy.call_args_list)
    for call_args in call_args_list:
        obs = call_args.args[1]
        shot_range, bin_size = (
            call_args.kwargs["shot_range"],
            call_args.kwargs["bin_size"],
        )
        meas = qml.var(op=obs)
        old_res = device.var(obs, shot_range, bin_size)
        if samples is not None:
            new_res = meas.process_samples(
                samples=samples, wire_order=device.wires, shot_range=shot_range, bin_size=bin_size
            )
        else:
            new_res = meas.process_state(state=state, wire_order=device.wires)
        assert qml.math.allclose(old_res, new_res)