def test_qnode_fails_on_wrong_return_type(self, qubit_device_2_wires):
    'The qfunc must return only Expectations'

    @qml.qnode(qubit_device_2_wires, interface='tf')
    def qf(x):
        qml.RX(x, wires=[0])
        return (qml.expval(qml.PauliZ(0)), 0.3)
    with pytest.raises(QuantumFunctionError, match='must return either'):
        qf(Variable(0.5))
The qfunc must return only Expectations
def test_qnode_fails_on_wrong_return_type(self, qubit_device_2_wires):
    

    @qml.qnode(qubit_device_2_wires, interface='tf')
    def qf(x):
        qml.RX(x, wires=[0])
        return (qml.expval(qml.PauliZ(0)), 0.3)
    with pytest.raises(QuantumFunctionError, match='must return either'):
        qf(Variable(0.5))