code: def test_apply_method_defaults():
      """Tests apply_method_defaults"""
  
      def dummy_fit_func(self, forecasts, actuals, **params):
          return {
              "self": self,
              "forecasts": forecasts,
              "actuals": actuals,
              "params": params,
          }
  
      # checks `dummy_fit_func`
      result = dummy_fit_func(
          self="self",
          forecasts="forecasts",
          actuals="actuals",
          method="mint_sample",
      )
      assert_equal(
          result,
          {
              "self": "self",
              "forecasts": "forecasts",
              "actuals": "actuals",
              "params": {"method": "mint_sample"},
          },
      )
  
      # `method` != "custom"
      new_fit_func = apply_method_defaults(dummy_fit_func)
      params = {
          "method": "mint_sample",
          "covariance": "identity",
          "verbose": True,
      }
      result = new_fit_func(
          self="self",
          forecasts="forecasts",
          actuals="actuals",
          **params,
      )
      params.update(get_fit_params("mint_sample"))
      assert_equal(
          result,
          {
              "self": "self",
              "forecasts": "forecasts",
              "actuals": "actuals",
              "params": params,
          },
      )
      assert (
          params["covariance"] == "sample"
      )  # overwritten by the default
  
      # `method` == "custom"
      new_fit_func = apply_method_defaults(dummy_fit_func)
      params = {
          "method": "custom",
          "covariance": "identity",
          "verbose": True,
      }
      result = new_fit_func(
          self="self",
          forecasts="forecasts",
          actuals="actuals",
          **params,
      )
      assert_equal(
          result,
          {
              "self": "self",
              "forecasts": "forecasts",
              "actuals": "actuals",
              "params": params,
          },
      )
  
imports: import math
  import os
  import warnings
  import cvxpy
  import numpy
  import pandas
  import pytest
  from scipy.linalg import sqrtm
  from sklearn.exceptions import NotFittedError
  from greykite.algo.reconcile.convex.reconcile_forecasts import ReconcileAdditiveForecasts
  from greykite.algo.reconcile.convex.reconcile_forecasts import TraceInfo
  from greykite.algo.reconcile.convex.reconcile_forecasts import apply_method_defaults
  from greykite.algo.reconcile.convex.reconcile_forecasts import evaluation_plot
  from greykite.algo.reconcile.convex.reconcile_forecasts import get_fit_params
  from greykite.algo.reconcile.convex.reconcile_forecasts import get_weight_matrix
  from greykite.algo.reconcile.hierarchical_relationship import HierarchicalRelationship
  from greykite.common.constants import TIME_COL
  from greykite.common.data_loader import DataLoader
  from greykite.common.evaluation import mean_absolute_percent_error
  from greykite.common.evaluation import median_absolute_percent_error
  from greykite.common.evaluation import root_mean_squared_error
  from greykite.common.python_utils import assert_equal
  from greykite.common.python_utils import reorder_columns
label_desc: Use image node_id 4 for calling a global function with example usage: test_apply_method_defaults() and returns: dict