code: def test_apply_default_params():
      """Tests applying default parameters."""
      # No model components given.
      model = LagBasedTemplate()
      forecast_config = ForecastConfig()
      model.config = forecast_config
      model_components = ModelComponentsParam()
      model_components = (
          model.apply_lag_based_model_components_defaults(
              model_components=model_components
          )
      )
      assert model_components.custom == dict(
          freq=None,
          lag_unit=LagUnitEnum.week.name,
          lags=[1],
          agg_func=AggregationFunctionEnum.mean.name,
          agg_func_params=None,
          past_df=None,
          series_na_fill_func=None,
      )
      assert model_components.uncertainty == dict(uncertainty_dict=None)
  
      # Model components given.
      model = LagBasedTemplate()
      metadata_param = MetadataParam(
          time_col="ts", value_col="y", freq="W"
      )
      forecast_config = ForecastConfig(metadata_param=metadata_param)
      model.config = forecast_config
      model_components = ModelComponentsParam(
          seasonality=dict(yearly_seasonality=5),
          custom=dict(lag_unit=LagUnitEnum.day.name),
          uncertainty=dict(
              uncertainty_dict=dict(
                  uncertainty_method="simple_conditional_residuals"
              )
          ),
      )
      model_components = (
          model.apply_lag_based_model_components_defaults(
              model_components=model_components
          )
      )
      assert model_components.custom == dict(
          freq="W",  # ``freq`` is fetched from ``metadata_param``.
          lag_unit=LagUnitEnum.day.name,  # ``lag_unit`` is given by user
          lags=[1],
          agg_func=AggregationFunctionEnum.mean.name,
          agg_func_params=None,
          past_df=None,
          series_na_fill_func=None,
      )
      assert model_components.uncertainty == dict(
          uncertainty_dict=dict(
              uncertainty_method="simple_conditional_residuals"
          )  # ``uncertainty_dict`` is given by user
      )
  
imports: import pandas
  import pytest
  from testfixtures import LogCapture
  from greykite.common.aggregation_function_enum import AggregationFunctionEnum
  from greykite.common.constants import LOGGER_NAME
  from greykite.common.constants import PREDICTED_COL
  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.lag_based_template import LagBasedTemplate
  from greykite.framework.templates.model_templates import ModelTemplateEnum
  from greykite.framework.utils.result_summary import summarize_grid_search_results
  from greykite.sklearn.estimator.lag_based_estimator import LagBasedEstimator
  from greykite.sklearn.estimator.lag_based_estimator import LagUnitEnum
label_desc: Use image node_id 5 for calling a global function with example usage: test_apply_default_params() without return types