class_docstr: Tests for the ``adjoint_jacobian`` method
class_docstr_tok: ["Tests","for","the","``","adjoint_jacobian","``","method"]
docstr: Test attempting to compute the gradient of a tape that obtains the
  expectation value of a Hermitian operator emits a warning if the
  parameters to Hermitian are trainable.
docstr_tok: ["Test","attempting","to","compute","the","gradient","of","a","tape","that","obtains","the","expectation","value","of","a","Hermitian","operator","emits","a","warning","if","the","parameters","to","Hermitian","are","trainable","."]
code: def test_trainable_hermitian_warns(self):
      """Test attempting to compute the gradient of a tape that obtains the
      expectation value of a Hermitian operator emits a warning if the
      parameters to Hermitian are trainable."""
      dev = qml.device("default.qubit.legacy", wires=3)
  
      mx = qml.matrix(qml.PauliX(0) @ qml.PauliY(2))
      with qml.queuing.AnnotatedQueue() as q:
          qml.expval(qml.Hermitian(mx, wires=[0, 2]))
  
      tape = qml.tape.QuantumScript.from_queue(q)
      tape.trainable_params = {0}
      with pytest.warns(
          UserWarning,
          match="Differentiating with respect to the input parameters of Hermitian",
      ):
          dev.adjoint_jacobian(tape)
  
imports: import pytest
  import pennylane
  from pennylane import numpy
label_desc: Use image node_id 6 for calling the TestAdjointJacobian obj's underlying member method code with example usage: obj.test_trainable_hermitian_warns() without return types