code: def test_tolerance(df):
      """Tests ``tolerance``."""
      model = SeasonalityInferrer()
      result1 = model.infer_fourier_series_order(
          df=df,
          time_col=cst.TIME_COL,
          value_col=cst.VALUE_COL,
          configs=[
              SeasonalityInferConfig(
                  seas_name="yearly",
                  col_name="toy",
                  period=1.0,
                  max_order=50,
                  adjust_trend_param=dict(trend_average_col="year"),
                  tolerance=0.0,
                  aggregation_period="W",
                  offset=0,
              )
          ],
          adjust_trend_method="seasonal_average",
          fit_algorithm="linear",
          plotting=True,
          criterion="bic",
      )
      result2 = model.infer_fourier_series_order(
          df=df,
          time_col=cst.TIME_COL,
          value_col=cst.VALUE_COL,
          configs=[
              SeasonalityInferConfig(
                  seas_name="yearly",
                  col_name="toy",
                  period=1.0,
                  max_order=50,
                  adjust_trend_param=dict(trend_average_col="year"),
                  tolerance=1.0,
                  aggregation_period="W",
                  offset=0,
              )
          ],
          adjust_trend_method="seasonal_average",
          fit_algorithm="linear",
          plotting=True,
          criterion="bic",
      )
      # With `tolerance`, the new order is smaller.
      assert (
          result2["best_orders"]["yearly"]
          < result1["best_orders"]["yearly"]
      )
  
file_path: greykite/greykite/tests/algo/common/test_seasonality_inferrer.py
imports: from copy import deepcopy
  import pandas
  import pytest
  from greykite.algo.common.seasonality_inferrer import SeasonalityInferConfig
  from greykite.algo.common.seasonality_inferrer import SeasonalityInferrer
  from greykite.algo.common.seasonality_inferrer import TrendAdjustMethodEnum
  from greykite.common import constants
  from greykite.common.testing_utils import assert_equal
  from greykite.common.testing_utils import generate_df_for_tests
  from greykite.common.time_properties import infer_freq
label_desc: Use image node_id 9 for calling a global function with example usage: test_tolerance(df) without return types