code: def test_get_spectrum_complains_no_generator():
      """Test that an error is raised if the operator has no generator defined."""
  
      # pylint: disable=too-few-public-methods
      class CustomOp(qml.operation.Operation):
          num_wires = 1
          num_params = 1
  
      with pytest.raises(
          qml.operation.GeneratorUndefinedError,
          match="does not have a generator",
      ):
          get_spectrum(CustomOp(0.5, wires=0), decimals=10)
  
imports: import pytest
  import numpy
  import pennylane
  from pennylane.fourier.utils import format_nvec, get_spectrum, join_spectra
label_desc: Use image node_id 4 for calling a global function with example usage: test_get_spectrum_complains_no_generator() without return types