class_docstr: Unit tests for TensorFlow execution
class_docstr_tok: ["Unit","tests","for","TensorFlow","execution"]
docstr: Test that an error is raised if a gradient transform
  is used with grad_on_execution
docstr_tok: ["Test","that","an","error","is","raised","if","a","gradient","transform","is","used","with","grad_on_execution"]
code: def test_incorrect_grad_on_execution(self):
      """Test that an error is raised if a gradient transform
      is used with grad_on_execution"""
      a = tf.Variable([0.1, 0.2])
  
      dev = qml.device("default.qubit.legacy", wires=1)
  
      with tf.GradientTape():
          with qml.queuing.AnnotatedQueue() as q:
              qml.RY(a[0], wires=0)
              qml.RX(a[1], wires=0)
              qml.expval(qml.PauliZ(0))
  
          tape = qml.tape.QuantumScript.from_queue(q)
      with pytest.raises(
          ValueError,
          match="Gradient transforms cannot be used with grad_on_execution=True",
      ):
          execute(
              [tape],
              dev,
              gradient_fn=param_shift,
              grad_on_execution=True,
              interface="tf",
          )
  
imports: import numpy
  import pytest
  import pennylane
  from pennylane.gradients import finite_diff, param_shift
  from pennylane import execute
label_desc: Use image node_id 2 for calling the TestTensorFlowExecuteUnitTests obj's underlying member method code with example usage: obj.test_incorrect_grad_on_execution() without return types