code: def test_sp_to_use_upto_max_sp():
      """Seasonal Period detection upto a max seasonal period provided by user."""
      data = get_data("airline", verbose=False)
  
      # 1.0 Max SP not specified ----
      exp = TSForecastingExperiment()
      exp.setup(
          data=data,
          fh=12,
          session_id=42,
          remove_harmonics=False,
          max_sp_to_consider=None,
      )
      assert exp.candidate_sps == [12, 24, 36, 11, 48]
      assert exp.significant_sps == [12, 24, 36, 11, 48]
      assert exp.significant_sps_no_harmonics == [48, 36, 11]
      assert exp.all_sps_to_use == [12]
      assert exp.primary_sp_to_use == 12
  
      # 2.0 Max SP more than at least some detected values ----
      # 2.1 Without removing harmonics
      exp = TSForecastingExperiment()
      exp.setup(
          data=data,
          fh=12,
          session_id=42,
          remove_harmonics=False,
          max_sp_to_consider=24,
      )
      assert exp.candidate_sps == [12, 24, 11]
      assert exp.significant_sps == [12, 24, 11]
      assert exp.significant_sps_no_harmonics == [24, 11]
      assert exp.all_sps_to_use == [12]
      assert exp.primary_sp_to_use == 12
  
      # 2.2 Removing harmonics
      exp = TSForecastingExperiment()
      exp.setup(
          data=data,
          fh=12,
          session_id=42,
          remove_harmonics=True,
          max_sp_to_consider=24,
      )
      assert exp.candidate_sps == [12, 24, 11]
      assert exp.significant_sps == [12, 24, 11]
      assert exp.significant_sps_no_harmonics == [24, 11]
      assert exp.all_sps_to_use == [24]
      assert exp.primary_sp_to_use == 24
  
      # 3.0 Max SP less than all detected values ----
      # 3.1 Without removing harmonics
      exp = TSForecastingExperiment()
      exp.setup(
          data=data,
          fh=12,
          session_id=42,
          remove_harmonics=False,
          max_sp_to_consider=2,
      )
      assert exp.candidate_sps == []
      assert exp.significant_sps == [1]
      assert exp.significant_sps_no_harmonics == [1]
      assert exp.all_sps_to_use == [1]
      assert exp.primary_sp_to_use == 1
  
      # 3.2 Removing harmonics
      exp = TSForecastingExperiment()
      exp.setup(
          data=data,
          fh=12,
          session_id=42,
          remove_harmonics=True,
          max_sp_to_consider=2,
      )
      assert exp.candidate_sps == []
      assert exp.significant_sps == [1]
      assert exp.significant_sps_no_harmonics == [1]
      assert exp.all_sps_to_use == [1]
      assert exp.primary_sp_to_use == 1
  
imports: import math
  import numpy
  import pandas
  import pytest
  from time_series_test_utils import _get_seasonal_values, _get_seasonal_values_alphanumeric, _return_data_seasonal_types_strictly_pos, _return_setup_args_raises, _return_splitter_args
  from pycaret.datasets import get_data
  from pycaret.time_series import TSForecastingExperiment
label_desc: Use image node_id 9 for calling a global function with example usage: test_sp_to_use_upto_max_sp() without return types