code: def test_template_no_adjoint():
      """Test that qnspsa iterates when the operations do not have a custom adjoint."""
  
      num_qubits = 2
      dev = qml.device("default.qubit", wires=num_qubits)
  
      @qml.qnode(dev)
      def cost(params):
          qml.RandomLayers(
              weights=params, wires=range(num_qubits), seed=42
          )
          return qml.expval(qml.PauliZ(0) @ qml.PauliZ(1))
  
      params = np.random.normal(0, np.pi, (2, 4))
      opt = qml.QNSPSAOptimizer(stepsize=5e-2)
      assert opt.step_and_cost(
          cost, params
      )  # just checking it runs without error
      assert not qml.RandomLayers.has_adjoint
  
file_path: pennylane/tests/optimize/test_qnspsa.py
imports: from copy import deepcopy
  import pytest
  from scipy.linalg import sqrtm
  import pennylane
  from pennylane import numpy
label_desc: Use image node_id 5 for calling a global function with example usage: test_template_no_adjoint() and returns: qml