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 fewer than one samples for the stochastic shift rule are requested.
docstr_tok: ["Test","that","an","error","is","raised","if","fewer","than","one","samples","for","the","stochastic","shift","rule","are","requested","."]
code: def test_raises_for_less_than_one_sample(self, num_split_times):
      """Test that an error is raised if fewer than one samples for the stochastic shift rule are requested."""
      tape = qml.tape.QuantumScript([])
      with pytest.raises(
          ValueError, match="Expected a positive number of samples"
      ):
          stoch_pulse_grad(tape, num_split_times=num_split_times)
  
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 3 for calling the TestStochPulseGradErrors obj's underlying member method code with example usage: obj.test_raises_for_less_than_one_sample(num_split_times) without return types