class_docstr: Tests for adjoint_jacobian
class_docstr_tok: ["Tests","for","adjoint_jacobian"]
docstr: Tests that the device gradient of an arbitrary Euler-angle-parameterized gate is
  correct.
code: def test_Rot_gradient(self, theta, tol):
      """Tests that the device gradient of an arbitrary Euler-angle-parameterized gate is
      correct."""
      params = np.array([theta, theta**3, np.sqrt(2) * theta])
      prep_op = qml.StatePrep(
          np.array([1.0, -1.0], requires_grad=False) / np.sqrt(2),
          wires=0,
      )
  
      qs = QuantumScript(
          ops=[prep_op, qml.Rot(*params, wires=[0])],
          measurements=[qml.expval(qml.PauliZ(0))],
          trainable_params=[1, 2, 3],
      )
  
      qs_valid, _ = qml.devices.preprocess.decompose(qs, adjoint_ops)
      qs = qs_valid[0]
  
      qs.trainable_params = {1, 2, 3}
  
      calculated_val = adjoint_jacobian(qs)
  
      # compare to finite differences
      tapes, fn = qml.gradients.finite_diff(qs)
      results = tuple(qml.devices.qubit.simulate(t) for t in tapes)
      numeric_val = fn(results)
      assert np.allclose(calculated_val, numeric_val, atol=tol, rtol=0)
      assert isinstance(calculated_val, tuple)
  
imports: import pytest
  import pennylane
  from pennylane.devices.qubit import adjoint_jacobian, adjoint_jvp, adjoint_vjp
  from pennylane.tape import QuantumScript
  import pennylane.numpy
label_desc: Use image node_id 3 for calling the TestAdjointJacobian obj's underlying member method code with example usage: obj.test_Rot_gradient(theta, tol) without return types