class_docstr: Test errors raised by stoch_pulse_grad.
class_docstr_tok: ["Test","errors","raised","by","stoch_pulse_grad","."]
docstr: Test that an error is raised for an invalid reordering function of
  a HardwareHamiltonian.
docstr_tok: ["Test","that","an","error","is","raised","for","an","invalid","reordering","function","of","a","HardwareHamiltonian","."]
code: def test_raises_for_invalid_reorder_fn(self, reorder_fn):
      """Test that an error is raised for an invalid reordering function of
      a HardwareHamiltonian."""
  
      H = qml.pulse.transmon_drive(
          qml.pulse.constant, 0.0, 0.0, wires=[0]
      )
      H.reorder_fn = reorder_fn
      ops = [qml.evolve(H)([0.152], 0.3)]
      tape = qml.tape.QuantumScript(
          ops, measurements=[qml.expval(qml.PauliZ(0))]
      )
      tape.trainable_params = [0]
      _match = "Only permutations, fan-out or fan-in functions are allowed as reordering"
      with pytest.raises(ValueError, match=_match):
          stoch_pulse_grad(tape)
  
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 8 for calling the TestStochPulseGradErrors obj's underlying member method code with example usage: obj.test_raises_for_invalid_reorder_fn(reorder_fn) without return types