code: def test_get_spectrum(op, expected):
      """Test that the spectrum is correctly extracted from an operator."""
      spec = get_spectrum(op, decimals=10)
      assert np.allclose(sorted(spec), expected, atol=1e-6, rtol=0)
  
imports: import pytest
  import numpy
  import pennylane
  from pennylane.fourier.utils import format_nvec, get_spectrum, join_spectra
label_desc: Use image node_id 3 for calling a global function with example usage: test_get_spectrum(op, expected) without return types