def METHOD_NAME(self):
    """Tests that NotImplementedError is raised for methods other than ``'qwc'``."""
    observables = [PauliY(0), PauliX(0) @ PauliX(1), PauliZ(1)]
    grouping = "anticommuting"
    with pytest.raises(
        NotImplementedError,
        match="Measurement reduction by 'anticommuting' grouping not implemented",
    ):
        optimize_measurements(observables, grouping=grouping)