def METHOD_NAME(self, state, shots, mocker):
    """Tests that the variance of a ``Projector`` object is computed correctly."""
    dev = qml.device("default.qubit.legacy", wires=3, shots=shots)
    spy = mocker.spy(qml.QubitDevice, "var")
    @qml.qnode(dev)
    def circuit():
        qml.Hadamard(0)
        return qml.var(qml.Projector(state, wires=range(3)))
    res = circuit()
    expected = [0.25, 0.25] if isinstance(shots, list) else 0.25
    assert np.allclose(res, expected, atol=0.02, rtol=0.02)
    custom_measurement_process(dev, spy)