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 if the option `use_broadcasting` is activated
  for a tape that already is broadcasted.
docstr_tok: ["Test","that","an","error","is","raised","if","the","option","`","use_broadcasting","`","is","activated","for","a","tape","that","already","is","broadcasted","."]
code: def test_raises_use_broadcasting_with_broadcasted_tape(self):
      """Test that an error is raised if the option `use_broadcasting` is activated
      for a tape that already is broadcasted."""
      ham = qml.dot([qml.pulse.constant], [qml.PauliX(0)])
      ops = [qml.evolve(ham, return_intermediate=True)([0.152], 0.3)]
      tape = qml.tape.QuantumScript(
          ops, measurements=[qml.expval(qml.PauliZ(0))]
      )
      tape.trainable_params = [0]
      with pytest.raises(
          ValueError,
          match="Broadcasting is not supported for tapes that",
      ):
          stoch_pulse_grad(tape, use_broadcasting=True)
  
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 7 for calling the TestStochPulseGradErrors obj's underlying member method code with example usage: obj.test_raises_use_broadcasting_with_broadcasted_tape() without return types