class_docstr: Test that the QDrift template integrates well with the rest of PennyLane
class_docstr_tok: ["Test","that","the","QDrift","template","integrates","well","with","the","rest","of","PennyLane"]
docstr: Test that an error is raised if we require a gradient of QDrift with respect to hamiltonian coefficients.
docstr_tok: ["Test","that","an","error","is","raised","if","we","require","a","gradient","of","QDrift","with","respect","to","hamiltonian","coefficients","."]
code: def test_error_gradient_workflow_jax(self):
      """Test that an error is raised if we require a gradient of QDrift with respect to hamiltonian coefficients."""
      import jax
      from jax import numpy as jnp
  
      time = jnp.array(1.5)
      coeffs = jnp.array([1.23, -0.45])
  
      terms = [qml.PauliX(0), qml.PauliZ(0)]
      dev = qml.device("default.qubit", wires=1)
  
      @qml.qnode(dev)
      def circ(time, coeffs):
          h = qml.dot(coeffs, terms)
          qml.QDrift(h, time, n=3)
          return qml.expval(qml.Hadamard(0))
  
      msg = "The QDrift template currently doesn't support differentiation through the coefficients of the input Hamiltonian."
      with pytest.raises(qml.QuantumFunctionError, match=msg):
          jax.grad(circ, argnums=[1])(time, coeffs)
  
imports: import copy
  from functools import reduce
  import pytest
  import pennylane
  from pennylane import numpy
  from pennylane.math import allclose, isclose
  from pennylane.templates.subroutines.qdrift import _sample_decomposition
label_desc: Use image node_id 10 for calling the TestIntegration obj's underlying member method code with example usage: obj.test_error_gradient_workflow_jax() and returns: qml