code: def test_apply_default_value(configs):
      """Tests apply default value util function."""
      model = SeasonalityInferrer()
      # Overrides value.
      configs_new = model._apply_default_value(
          configs=deepcopy(configs),
          param_name="offset",
          override_value=2,
          default_value=10,
      )
      assert configs_new[0].offset == 2
      assert configs_new[1].offset == 2
      # Does not override value and fills with default value.
      configs_new = model._apply_default_value(
          configs=deepcopy(configs),
          param_name="offset",
          override_value=None,
          default_value=10,
      )
      assert configs_new[0].offset == 1
      assert configs_new[1].offset == 10
      # Override value not valid.
      with pytest.raises(
          ValueError,
          match=f"The parameter 'offset' has value 2, "
          f"which is not valid. Valid values are '\\[1, 3\\]'.",
      ):
          model._apply_default_value(
              configs=deepcopy(configs),
              param_name="offset",
              override_value=2,
              default_value=1,
              allowed_values=[1, 3],
          )
      # Given value not valid.
      with pytest.raises(
          ValueError,
          match=f"The parameter 'offset' in SeasonalityInferConfig has value 1, "
          f"which is not valid. Valid values are '\\[2, 3\\]'.",
      ):
          model._apply_default_value(
              configs=deepcopy(configs),
              param_name="offset",
              override_value=None,
              default_value=2,
              allowed_values=[2, 3],
          )
  
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 6 for calling a global function with example usage: test_apply_default_value(configs) without return types