class_docstr: Tests for the SPSA gradient transform
class_docstr_tok: ["Tests","for","the","SPSA","gradient","transform"]
docstr: Test that the correct ouput and warning is generated in the absence of any trainable
  parameters with multiple returns.
docstr_tok: ["Test","that","the","correct","ouput","and","warning","is","generated","in","the","absence","of","any","trainable","parameters","with","multiple","returns","."]
code: def test_no_trainable_params_multiple_return_tape(self):
      """Test that the correct ouput and warning is generated in the absence of any trainable
      parameters with multiple returns."""
      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))
          qml.probs(wires=[0, 1])
  
      tape = qml.tape.QuantumScript.from_queue(
          q, shots=default_shot_vector
      )
      tape.trainable_params = []
      with pytest.warns(
          UserWarning,
          match="gradient of a tape with no trainable parameters",
      ):
          g_tapes, post_processing = spsa_grad(tape, h=h_val)
      res = post_processing(qml.execute(g_tapes, dev, None))
  
      assert g_tapes == []
      assert isinstance(res, tuple)
      assert len(res) == len(default_shot_vector)
      for _res in res:
          assert isinstance(_res, tuple)
          assert len(_res) == 2
          assert _res[0].shape == (0,)
          assert _res[1].shape == (0,)
  
imports: import numpy
  import pytest
  from pennylane import numpy
  import pennylane
  from pennylane.gradients import spsa_grad
  from pennylane.devices import DefaultQubitLegacy
  from pennylane.measurements import Shots
  from pennylane.operation import Observable, AnyWires
label_desc: Use image node_id 4 for calling the TestSpsaGradient obj's underlying member method code with example usage: obj.test_no_trainable_params_multiple_return_tape() without return types