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_simple_qnode_expval_two_evolves(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_x = 0.1
      T_y = 0.2
      ham_x = qml.pulse.constant * X(0)
      ham_y = qml.pulse.constant * X(0)
  
      @qml.qnode(dev, interface="jax", diff_method=pulse_odegen)
      def circuit(params):
          qml.evolve(ham_x)(params[0], T_x)
          qml.evolve(ham_y)(params[1], T_y)
          return qml.expval(Z(0))
  
      params = [[jnp.array(0.4)], [jnp.array(-0.1)]]
      grad = jax.jacobian(circuit)(params)
      p_x = params[0][0] * T_x
      p_y = params[1][0] * T_y
      exp_grad = [
          [-2 * jnp.sin(2 * (p_x + p_y)) * T_x],
          [-2 * jnp.sin(2 * (p_x + p_y)) * T_y],
      ]
      assert qml.math.allclose(grad, exp_grad)
  
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 2 for calling the TestPulseOdegenIntegration obj's underlying member method code with example usage: obj.test_simple_qnode_expval_two_evolves(dev_name) and returns: qml