class_docstr: Tests for adjoint_jacobian
class_docstr_tok: ["Tests","for","adjoint_jacobian"]
docstr: Tests provides correct answer when provided state preparation operation.
code: def test_state_prep(self, prep_op, tol):
      """Tests provides correct answer when provided state preparation operation."""
      x, y, z = [0.5, 0.3, -0.7]
  
      qs = QuantumScript(
          [
              prep_op,
              qml.RX(0.4, wires=[0]),
              qml.Rot(x, y, z, wires=[0]),
              qml.RY(-0.2, wires=[0]),
          ],
          [qml.expval(qml.PauliZ(0))],
          trainable_params=[2, 3, 4],
      )
  
      qs_valid, _ = qml.devices.preprocess.decompose(qs, adjoint_ops)
      qs_valid = qs_valid[0]
  
      qs_valid.trainable_params = {2, 3, 4}
  
      grad_D = adjoint_jacobian(qs_valid)
      tapes, fn = qml.gradients.finite_diff(qs)
      results = tuple(qml.devices.qubit.simulate(t) for t in tapes)
      grad_F = fn(results)
  
      assert np.allclose(grad_D, grad_F, atol=tol, rtol=0)
  
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 8 for calling the TestAdjointJacobian obj's underlying member method code with example usage: obj.test_state_prep(prep_op, tol) without return types