class_docstr: Test that stoch_pulse_grad integrates correctly with QNodes.
class_docstr_tok: ["Test","that","stoch_pulse_grad","integrates","correctly","with","QNodes","."]
docstr: Test that a simple qnode that returns an expectation value
  can be differentiated with stoch_pulse_grad.
docstr_tok: ["Test","that","a","simple","qnode","that","returns","an","expectation","value","can","be","differentiated","with","stoch_pulse_grad","."]
code: def test_qnode_expval_single_par(self, dev_name):
      """Test that a simple qnode that returns an expectation value
      can be differentiated with stoch_pulse_grad."""
      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 = qml.pulse.constant * qml.PauliY(0)
  
      @qml.qnode(dev, interface="jax")
      def circuit(params):
          qml.evolve(ham_single_q_const)([params], T)
          return qml.expval(qml.PauliZ(0))
  
      params = jnp.array(0.4)
      with qml.Tracker(dev) as tracker:
          _match = "stochastic pulse parameter-shift .* scalar pulse parameters."
          grad = stoch_pulse_grad(circuit, num_split_times=2)(params)
  
      p = params * T
      exp_grad = -2 * jnp.sin(2 * p) * T
      assert jnp.allclose(grad, exp_grad)
      assert tracker.totals["executions"] == 4
  
imports: import warnings
  import copy
  import pytest
  import numpy
  import pennylane
  from pennylane.gradients.general_shift_rules import eigvals_to_frequencies, generate_shift_rule
  from pennylane.gradients.pulse_gradient import _parshift_and_integrate, _split_evol_ops, _split_evol_tape, stoch_pulse_grad
label_desc: Use image node_id 2 for calling the TestStochPulseGradQNode obj's underlying member method code with example usage: obj.test_qnode_expval_single_par(dev_name) and returns: qml