code: def test_apply_forecast_config(df_config):
      """Tests `apply_forecast_config`"""
      df = df_config["df"]
      config = df_config["config"]
      model_template = df_config["model_template"]
      reg_cols = df_config["reg_cols"]
  
      # The same class can be re-used. `df` and `config` are taken from the function call
      #   to `apply_forecast_config`. Only `model_template_enum` and
      #   `default_model_template_name` are persistent in the state.
      forecaster = Forecaster(
          default_model_template_name=ModelTemplateEnum.SILVERKITE.name
      )
  
      # no config
      with warnings.catch_warnings():
          warnings.simplefilter("ignore")
          pipeline_params = forecaster.apply_forecast_config(df=df)
  
          template_class = SimpleSilverkiteTemplate  # based on `default_model_template_name`
          expected_pipeline_params = (
              template_class().apply_template_for_pipeline_params(df=df)
          )
          assert_basic_pipeline_equal(
              pipeline_params.pop("pipeline"),
              expected_pipeline_params.pop("pipeline"),
          )
          assert_equal(pipeline_params, expected_pipeline_params)
          assert forecaster.config is not None
          assert forecaster.template_class == template_class
          assert isinstance(
              forecaster.template, forecaster.template_class
          )
          assert forecaster.pipeline_params is not None
  
      # custom config
      with warnings.catch_warnings():
          warnings.simplefilter("ignore")
          pipeline_params = forecaster.apply_forecast_config(
              df=df, config=config
          )
  
          template_class = ModelTemplateEnum[
              model_template
          ].value.template_class  # SimpleSilverkiteTemplate
          expected_pipeline_params = (
              template_class().apply_template_for_pipeline_params(
                  df, config
              )
          )
          expected_pipeline = expected_pipeline_params.pop("pipeline")
          assert_basic_pipeline_equal(
              pipeline_params.pop("pipeline"), expected_pipeline
          )
          assert_equal(pipeline_params, expected_pipeline_params)
  
          # Custom `model_template_enum`. Same result, because
          #   `MySimpleSilverkiteTemplate` has the same apply_template_for_pipeline_params
          #   as `SimpleSilverkiteTemplate`.
          forecaster = Forecaster(
              model_template_enum=MyModelTemplateEnum
          )
          pipeline_params = forecaster.apply_forecast_config(
              df=df, config=config
          )
          assert_basic_pipeline_equal(
              pipeline_params.pop("pipeline"), expected_pipeline
          )
          assert_equal(pipeline_params, expected_pipeline_params)
  
      if "prophet" in sys.modules:
          # `model_component` of config is incompatible with model_template
          forecaster = Forecaster()
          config = ForecastConfig(
              model_template=ModelTemplateEnum.PROPHET.name,
              model_components_param=ModelComponentsParam(
                  regressors={"regressor_cols": reg_cols}
              ),
          )
          with pytest.raises(ValueError) as record:
              forecaster.apply_forecast_config(df=df, config=config)
              assert (
                  "Unexpected key(s) found: {'regressor_cols'}. The valid keys are: "
                  "dict_keys(['add_regressor_dict'])" in str(record)
              )
  
          # metadata of config is incompatible with df
          df = df.rename(
              columns={
                  TIME_COL: "some_time_col",
                  VALUE_COL: "some_value_col",
              }
          )
          with pytest.raises(
              ValueError, match="ts column is not in input data"
          ):
              forecaster.apply_forecast_config(df=df, config=config)
  
imports: import sys
  import warnings
  from enum import Enum
  import numpy
  import pandas
  import pytest
  from testfixtures import LogCapture
  from greykite.common.constants import LOGGER_NAME
  from greykite.common.constants import PREDICTED_LOWER_COL
  from greykite.common.constants import PREDICTED_UPPER_COL
  from greykite.common.constants import TIME_COL
  from greykite.common.constants import VALUE_COL
  from greykite.common.data_loader import DataLoader
  from greykite.common.evaluation import EvaluationMetricEnum
  from greykite.common.python_utils import assert_equal
  from greykite.common.testing_utils import generate_df_for_tests
  from greykite.common.testing_utils import generate_df_with_reg_for_tests
  from greykite.framework.templates.autogen.forecast_config import ComputationParam
  from greykite.framework.templates.autogen.forecast_config import EvaluationMetricParam
  from greykite.framework.templates.autogen.forecast_config import EvaluationPeriodParam
  from greykite.framework.templates.autogen.forecast_config import ForecastConfig
  from greykite.framework.templates.autogen.forecast_config import MetadataParam
  from greykite.framework.templates.autogen.forecast_config import ModelComponentsParam
  from greykite.framework.templates.forecaster import Forecaster
  from greykite.framework.templates.model_templates import ModelTemplate
  from greykite.framework.templates.model_templates import ModelTemplateEnum
  from greykite.framework.templates.prophet_template import ProphetTemplate
  from greykite.framework.templates.silverkite_template import SilverkiteTemplate
  from greykite.framework.templates.simple_silverkite_template import SimpleSilverkiteTemplate
  from greykite.framework.templates.simple_silverkite_template_config import SILVERKITE_COMPONENT_KEYWORDS
  from greykite.framework.templates.simple_silverkite_template_config import SimpleSilverkiteTemplateOptions
  from greykite.framework.utils.framework_testing_utils import assert_basic_pipeline_equal
  from greykite.framework.utils.framework_testing_utils import assert_forecast_pipeline_result_equal
  from greykite.framework.utils.framework_testing_utils import check_forecast_pipeline_result
  from greykite.framework.utils.result_summary import summarize_grid_search_results
label_desc: Use image node_id 5 for calling a global function with example usage: test_apply_forecast_config(df_config) without return types