class_docstr: Unit tests for TensorFlow execution
class_docstr_tok: ["Unit","tests","for","TensorFlow","execution"]
docstr: Test that no grad on execution uses the `device.batch_execute` and `device.gradients` pathway
docstr_tok: ["Test","that","no","grad","on","execution","uses","the","`","device.batch_execute","`","and","`","device.gradients","`","pathway"]
code: def test_no_grad_execution(self, mocker):
      """Test that no grad on execution uses the `device.batch_execute` and `device.gradients` pathway"""
      dev = qml.device("default.qubit.legacy", wires=1)
      spy_execute = mocker.spy(
          qml.devices.DefaultQubitLegacy, "batch_execute"
      )
      spy_gradients = mocker.spy(
          qml.devices.DefaultQubitLegacy, "gradients"
      )
      a = tf.Variable([0.1, 0.2])
  
      with tf.GradientTape() as t:
          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)
          res = execute(
              [tape],
              dev,
              gradient_fn="device",
              grad_on_execution=False,
              gradient_kwargs={"method": "adjoint_jacobian"},
              interface="tf",
          )[0]
  
      assert dev.num_executions == 1
      spy_execute.assert_called()
      spy_gradients.assert_not_called()
  
      t.jacobian(res, a)
      spy_gradients.assert_called()
  
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 4 for calling the TestTensorFlowExecuteUnitTests obj's underlying member method code with example usage: obj.test_no_grad_execution(mocker) without return types