code: def test_forecast_config_from_json():
      """Tests `from_json` method in `ForecastConfig."""
      for param in [
          FORECAST_CONFIG_JSON_DEFAULT,
          FORECAST_CONFIG_JSON_COMPLETE,
      ]:
          forecast_config = param.get("forecast_config")
          forecast_json = param.get("forecast_json")
          translated_forecast_config = ForecastConfig.from_json(
              forecast_json
          )
          assert_equal_forecast_config(
              forecast_config, translated_forecast_config
          )
  
          # Raises error when input is not a string
      with pytest.raises(ValueError, match="is not a json string."):
          ForecastConfig.from_json(5)
  
      # Raises error when input is not a json string
      with pytest.raises(ValueError, match="not a json string"):
          json_str = "This is not a json str"
          ForecastConfig.from_json(json_str)
  
imports: import json
  from copy import deepcopy
  from typing import Optional
  import pandas
  import pytest
  from pytest import fail
  from greykite.common.constants import TIME_COL
  from greykite.common.constants import VALUE_COL
  from greykite.common.evaluation import EvaluationMetricEnum
  from greykite.framework.constants import COMPUTATION_N_JOBS
  from greykite.framework.constants import COMPUTATION_VERBOSE
  from greykite.framework.constants import CV_REPORT_METRICS_ALL
  from greykite.framework.constants import EVALUATION_PERIOD_CV_MAX_SPLITS
  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.autogen.forecast_config import assert_equal_forecast_config
  from greykite.framework.templates.autogen.forecast_config import forecast_config_from_dict
  from greykite.framework.templates.autogen.forecast_config import from_list_dict
  from greykite.framework.templates.autogen.forecast_config import from_list_dict_or_none
  from greykite.framework.templates.autogen.forecast_config_utils import FORECAST_CONFIG_JSON_COMPLETE
  from greykite.framework.templates.autogen.forecast_config_utils import FORECAST_CONFIG_JSON_DEFAULT
  from greykite.framework.templates.forecast_config_defaults import ForecastConfigDefaults
  from greykite.framework.templates.model_templates import ModelTemplateEnum
label_desc: Use image node_id 15 for calling a global function with example usage: test_forecast_config_from_json() without return types