code: def test_forecast_result_silverkite(df, result):
      dump_obj(
          result,
          dir_name="silverkite",
          dump_design_info=True,
          overwrite_exist_dir=True,
      )
      result_rec = load_obj(
          dir_name="silverkite", load_design_info=True
      )
      recursive_rm_dir("silverkite")
  
      # Tests loaded results
      # Grid search cv results
      assert_equal(
          summarize_grid_search_results(result.grid_search),
          summarize_grid_search_results(result_rec.grid_search),
      )
      # Grid search attributes
      for key in result.grid_search.__dict__.keys():
          if key not in [
              "scoring",
              "estimator",
              "refit",
              "cv",
              "error_score",
              "cv_results_",
              "scorer_",
              "best_estimator_",
          ]:
              assert_equal(
                  result.grid_search.__dict__[key],
                  result_rec.grid_search.__dict__[key],
              )
  
      # Model
      assert_equal(
          result.model[-1].predict(df), result_rec.model[-1].predict(df)
      )
      assert result.model[-1].model_dict["x_design_info"] is not None
      # Model: estimator
      for key in result.model[-1].__dict__.keys():
          if key not in [
              "score_func",
              "silverkite",
              "silverkite_diagnostics",
              "model_dict",
          ]:
              assert_equal(
                  result.model[-1].__dict__[key],
                  result_rec.model[-1].__dict__[key],
              )
      assert_equal(
          inspect.getsource(result.model[-1].__dict__["score_func"]),
          inspect.getsource(
              result_rec.model[-1].__dict__["score_func"]
          ),
      )
      # Model: estimator/model_dict
      for key in result.model[-1].model_dict.keys():
          # Functions and classes are not testable.
          if key not in [
              "x_design_info",
              "fs_func",
              "ml_model",
              "plt_pred",
              "autoreg_dict",
              "changepoint_detector",
              "autoreg_func",
              "normalize_df_func",
          ]:
              assert_equal(
                  result.model[-1].model_dict[key],
                  result_rec.model[-1].model_dict[key],
              )
          # Tests function source code.
          elif key in [
              "fs_func",
              "plt_pred",
              "autoreg_func",
              "normalize_df_func",
          ]:
              assert_equal(
                  inspect.getsource(result.model[-1].model_dict[key]),
                  inspect.getsource(
                      result_rec.model[-1].model_dict[key]
                  ),
              )
      # Model: estimator/model_dict/autoreg_dict
      for key in result.model[-1].model_dict["autoreg_dict"].keys():
          if key not in ["series_na_fill_func"]:
              assert_equal(
                  result.model[-1].model_dict["autoreg_dict"][key],
                  result_rec.model[-1].model_dict["autoreg_dict"][key],
              )
      assert_equal(
          inspect.getsource(
              result.model[-1].model_dict["autoreg_dict"][
                  "series_na_fill_func"
              ]
          ),
          inspect.getsource(
              result_rec.model[-1].model_dict["autoreg_dict"][
                  "series_na_fill_func"
              ]
          ),
      )
  
      # Forecast
      assert_equal(
          result.forecast.estimator.predict(df),
          result_rec.forecast.estimator.predict(df),
      )
      assert (
          result.forecast.estimator.model_dict["x_design_info"]
          is not None
      )
      # Forecast: attributes
      for key in result.forecast.__dict__.keys():
          if key not in ["r2_loss_function", "estimator"]:
              assert_equal(
                  result.forecast.__dict__[key],
                  result_rec.forecast.__dict__[key],
              )
      assert_equal(
          inspect.getsource(
              result.forecast.__dict__["r2_loss_function"]
          ),
          inspect.getsource(
              result_rec.forecast.__dict__["r2_loss_function"]
          ),
      )
      # Forecast: estimator
      for key in result.forecast.estimator.__dict__.keys():
          if key not in [
              "score_func",
              "silverkite",
              "silverkite_diagnostics",
              "model_dict",
          ]:
              assert_equal(
                  result.forecast.estimator.__dict__[key],
                  result_rec.forecast.estimator.__dict__[key],
              )
      assert_equal(
          inspect.getsource(
              result.forecast.estimator.__dict__["score_func"]
          ),
          inspect.getsource(
              result_rec.forecast.estimator.__dict__["score_func"]
          ),
      )
      # Model: estimator/model_dict
      for key in result.forecast.estimator.model_dict.keys():
          # Functions and classes are not testable.
          if key not in [
              "x_design_info",
              "fs_func",
              "ml_model",
              "plt_pred",
              "autoreg_dict",
              "changepoint_detector",
              "autoreg_func",
              "normalize_df_func",
          ]:
              assert_equal(
                  result.forecast.estimator.model_dict[key],
                  result_rec.forecast.estimator.model_dict[key],
              )
          # Tests function source code.
          elif key in [
              "fs_func",
              "plt_pred",
              "autoreg_func",
              "normalize_df_func",
          ]:
              assert_equal(
                  inspect.getsource(
                      result.forecast.estimator.model_dict[key]
                  ),
                  inspect.getsource(
                      result_rec.forecast.estimator.model_dict[key]
                  ),
              )
      # Model: estimator/model_dict/autoreg_dict
      for key in result.forecast.estimator.model_dict[
          "autoreg_dict"
      ].keys():
          if key not in ["series_na_fill_func"]:
              assert_equal(
                  result.forecast.estimator.model_dict["autoreg_dict"][
                      key
                  ],
                  result_rec.forecast.estimator.model_dict[
                      "autoreg_dict"
                  ][key],
              )
      assert_equal(
          inspect.getsource(
              result.forecast.estimator.model_dict["autoreg_dict"][
                  "series_na_fill_func"
              ]
          ),
          inspect.getsource(
              result_rec.forecast.estimator.model_dict["autoreg_dict"][
                  "series_na_fill_func"
              ]
          ),
      )
  
      # Backtest
      assert_equal(
          result.backtest.estimator.predict(df),
          result_rec.backtest.estimator.predict(df),
      )
      assert (
          result.backtest.estimator.model_dict["x_design_info"]
          is not None
      )
      # Backtest: attributes
      for key in result.backtest.__dict__.keys():
          if key not in ["r2_loss_function", "estimator"]:
              assert_equal(
                  result.backtest.__dict__[key],
                  result_rec.backtest.__dict__[key],
              )
      assert_equal(
          inspect.getsource(
              result.backtest.__dict__["r2_loss_function"]
          ),
          inspect.getsource(
              result_rec.backtest.__dict__["r2_loss_function"]
          ),
      )
      # Backtest: estimator
      for key in result.backtest.estimator.__dict__.keys():
          if key not in [
              "score_func",
              "silverkite",
              "silverkite_diagnostics",
              "model_dict",
          ]:
              assert_equal(
                  result.backtest.estimator.__dict__[key],
                  result_rec.backtest.estimator.__dict__[key],
              )
      assert_equal(
          inspect.getsource(
              result.backtest.estimator.__dict__["score_func"]
          ),
          inspect.getsource(
              result_rec.backtest.estimator.__dict__["score_func"]
          ),
      )
      # Model: estimator/model_dict
      for key in result.backtest.estimator.model_dict.keys():
          # Functions and classes are not testable.
          if key not in [
              "x_design_info",
              "fs_func",
              "ml_model",
              "plt_pred",
              "autoreg_dict",
              "changepoint_detector",
              "autoreg_func",
              "normalize_df_func",
          ]:
              assert_equal(
                  result.backtest.estimator.model_dict[key],
                  result_rec.backtest.estimator.model_dict[key],
              )
          # Tests function source code.
          elif key in [
              "fs_func",
              "plt_pred",
              "autoreg_func",
              "normalize_df_func",
          ]:
              assert_equal(
                  inspect.getsource(
                      result.backtest.estimator.model_dict[key]
                  ),
                  inspect.getsource(
                      result_rec.backtest.estimator.model_dict[key]
                  ),
              )
      # Model: estimator/model_dict/autoreg_dict
      for key in result.backtest.estimator.model_dict[
          "autoreg_dict"
      ].keys():
          if key not in ["series_na_fill_func"]:
              assert_equal(
                  result.backtest.estimator.model_dict["autoreg_dict"][
                      key
                  ],
                  result_rec.backtest.estimator.model_dict[
                      "autoreg_dict"
                  ][key],
              )
      assert_equal(
          inspect.getsource(
              result.backtest.estimator.model_dict["autoreg_dict"][
                  "series_na_fill_func"
              ]
          ),
          inspect.getsource(
              result_rec.backtest.estimator.model_dict["autoreg_dict"][
                  "series_na_fill_func"
              ]
          ),
      )
  
      # Timeseries
      for key in result.timeseries.__dict__.keys():
          assert_equal(
              result.timeseries.__dict__[key],
              result_rec.timeseries.__dict__[key],
          )
  
imports: import inspect
  import os
  import sys
  from collections import OrderedDict
  import pytest
  from greykite.common.python_utils import assert_equal
  from greykite.common.testing_utils import generate_df_for_tests
  from greykite.framework.templates.autogen.forecast_config import ComputationParam
  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 ModelTemplateEnum
  from greykite.framework.templates.pickle_utils import dump_obj
  from greykite.framework.templates.pickle_utils import load_obj
  from greykite.framework.templates.pickle_utils import recursive_rm_dir
  from greykite.framework.utils.result_summary import summarize_grid_search_results
label_desc: Use image node_id 9 for calling a global function with example usage: test_forecast_result_silverkite(df, result) without return types