class_docstr: Test that pulse_odegen integrates correctly with QNodes.
class_docstr_tok: ["Test","that","pulse_odegen","integrates","correctly","with","QNodes","."]
docstr: Test that a simple qnode that returns an expectation value
  can be differentiated with pulse_odegen.
docstr_tok: ["Test","that","a","simple","qnode","that","returns","an","expectation","value","can","be","differentiated","with","pulse_odegen","."]
code: def test_qnode_expval_probs_single_par(self, dev_name):
      """Test that a simple qnode that returns an expectation value
      can be differentiated with pulse_odegen."""
      import jax
      import jax.numpy as jnp
  
      jax.config.update("jax_enable_x64", True)
      dev = qml.device(dev_name, wires=1)
      T = 0.2
      ham_single_q_const = jnp.polyval * Y(0)
  
      @qml.qnode(dev, interface="jax")
      def circuit(params):
          qml.evolve(ham_single_q_const)([params], T)
          return qml.probs(wires=0), qml.expval(Z(0))
  
      params = jnp.array([0.4, 0.9, 1.2])
      with qml.Tracker(dev) as tracker:
          jac = pulse_odegen(circuit)(params)
  
      assert tracker.totals["executions"] == 2  # two shifted tapes
      circuit(params)
      p = integral_of_polyval(params, T)
      p_jac = jax.jacobian(integral_of_polyval)(params, T)
      exp_jac = (
          jnp.outer(jnp.array([-1, 1]), jnp.sin(2 * p) * p_jac),
          -2 * jnp.sin(2 * p) * p_jac,
      )
      for j, e in zip(jac, exp_jac):
          assert qml.math.allclose(j, e)
  
imports: import copy
  import pytest
  import numpy
  import pennylane
  from pennylane import numpy
  from pennylane.ops.qubit.special_unitary import pauli_basis_matrices, pauli_basis_strings
  from pennylane.math import expand_matrix
  from pennylane.gradients.pulse_gradient_odegen import _generate_tapes_and_coeffs, pulse_odegen, _insert_op, _nonzero_coeffs_and_words, _one_parameter_generators, _one_parameter_paulirot_coeffs, _parshift_and_contract
label_desc: Use image node_id 3 for calling the TestPulseOdegenQNode obj's underlying member method code with example usage: obj.test_qnode_expval_probs_single_par(dev_name) and returns: qml,  qml