def test_qnode_fails_on_expval_not_returned(self, qubit_device_2_wires):
    'All expectation values in the qfunc must be returned'

    @qml.qnode(qubit_device_2_wires, interface='tf')
    def qf(x):
        qml.RX(x, wires=[0])
        ex = qml.expval(qml.PauliZ(1))
        return qml.expval(qml.PauliZ(0))
    with pytest.raises(QuantumFunctionError, match='All measured observables'):
        qf(Variable(0.5))
All expectation values in the qfunc must be returned
def test_qnode_fails_on_expval_not_returned(self, qubit_device_2_wires):
    

    @qml.qnode(qubit_device_2_wires, interface='tf')
    def qf(x):
        qml.RX(x, wires=[0])
        ex = qml.expval(qml.PauliZ(1))
        return qml.expval(qml.PauliZ(0))
    with pytest.raises(QuantumFunctionError, match='All measured observables'):
        qf(Variable(0.5))