class_docstr: Tests for the finite difference gradient transform
class_docstr_tok: ["Tests","for","the","finite","difference","gradient","transform"]
docstr: Test that the correct ouput and warning is generated in the absence of any trainable
  parameters
docstr_tok: ["Test","that","the","correct","ouput","and","warning","is","generated","in","the","absence","of","any","trainable","parameters"]
code: def test_no_trainable_params_tape(self):
      """Test that the correct ouput and warning is generated in the absence of any trainable
      parameters"""
      dev = qml.device(
          "default.qubit", wires=2, shots=default_shot_vector
      )
  
      weights = [0.1, 0.2]
      with qml.queuing.AnnotatedQueue() as q:
          qml.RX(weights[0], wires=0)
          qml.RY(weights[1], wires=0)
          qml.expval(qml.PauliZ(0) @ qml.PauliZ(1))
  
      tape = qml.tape.QuantumScript.from_queue(
          q, shots=default_shot_vector
      )
      # TODO: remove once #2155 is resolved
      tape.trainable_params = []
      with pytest.warns(
          UserWarning,
          match="gradient of a tape with no trainable parameters",
      ):
          g_tapes, post_processing = qml.gradients.finite_diff(
              tape, h=h_val
          )
      all_res = post_processing(qml.execute(g_tapes, dev, None))
      assert len(all_res) == len(default_shot_vector)
  
      for res in all_res:
          assert g_tapes == []
          assert isinstance(res, numpy.ndarray)
          assert res.shape == (0,)
  
imports: import numpy
  import pytest
  from pennylane import numpy
  import pennylane
  from pennylane.gradients import finite_diff
  from pennylane.devices import DefaultQubitLegacy
  from pennylane.measurements import Shots
  from pennylane.operation import Observable, AnyWires
label_desc: Use image node_id 3 for calling the TestFiniteDiff obj's underlying member method code with example usage: obj.test_no_trainable_params_tape() without return types