code: def test_error_missing_frequency_info_single_par():
      """Test that an error is raised if neither nums_frequency nor spectra is given
      for one of the function arguments."""
  
      opt = RotosolveOptimizer()
  
      def sum_named_arg(x):
          return qml.math.sum(x)
  
      x = np.arange(4, requires_grad=True)
      nums_frequency = {"x": {(0,): 1, (1,): 1}}
      spectra = {"x": {(0,): [0.0, 1.0], (2,): [0.0, 1.0]}}
  
      # For the first three entries either nums_frequency or spectra is provided
      with pytest.raises(
          ValueError, match=r"was provided for the entry \(3,\)"
      ):
          opt.step(
              sum_named_arg,
              x,
              nums_frequency=nums_frequency,
              spectra=spectra,
          )
  
imports: import functools
  import pytest
  from scipy.optimize import shgo
  import pennylane
  from pennylane import numpy
  from pennylane.utils import _flatten, unflatten
  from pennylane.optimize import RotosolveOptimizer
label_desc: Use image node_id 5 for calling a global function with example usage: test_error_missing_frequency_info_single_par() and returns: qml