code: def test_get_ranks_and_splits(pipeline_results):
      """Tests get_ranks_and_splits"""
      # string `score_func`, combine_splits=True
      grid_search = pipeline_results["1"].grid_search
      ranks_and_splits = get_ranks_and_splits(
          grid_search,
          score_func=EvaluationMetricEnum.MeanAbsolutePercentError.name,
          greater_is_better=None,
          combine_splits=True,
          decimals=None,
      )
  
      short_name = (
          EvaluationMetricEnum.MeanAbsolutePercentError.get_metric_name()
      )
      assert ranks_and_splits["short_name"] == short_name
      assert (
          ranks_and_splits["ranks"].argmin()
          == grid_search.cv_results_[f"mean_test_{short_name}"].argmin()
      )
      assert (
          ranks_and_splits["split_train"][2][1]
          == grid_search.cv_results_[f"split1_train_{short_name}"][2]
      )
      assert (
          ranks_and_splits["split_test"][3][0]
          == grid_search.cv_results_[f"split0_test_{short_name}"][3]
      )
  
      # `decimals=2`
      ranks_and_splits = get_ranks_and_splits(
          grid_search,
          score_func=EvaluationMetricEnum.MeanAbsolutePercentError.name,
          greater_is_better=None,
          combine_splits=True,
          decimals=2,
      )
      short_name = (
          EvaluationMetricEnum.MeanAbsolutePercentError.get_metric_name()
      )
      assert ranks_and_splits["short_name"] == short_name
      assert (
          ranks_and_splits["ranks"].argmin()
          == grid_search.cv_results_[f"mean_test_{short_name}"].argmin()
      )
      assert ranks_and_splits["split_train"][2][1] == round(
          grid_search.cv_results_[f"split1_train_{short_name}"][2], 2
      )
      assert ranks_and_splits["split_test"][3][0] == round(
          grid_search.cv_results_[f"split0_test_{short_name}"][3], 2
      )
  
      # callable `score_func`, `combine_splits=False`
      grid_search = pipeline_results["3"].grid_search
      ranks_and_splits = get_ranks_and_splits(
          grid_search,
          score_func=mean_absolute_error,
          greater_is_better=True,
          combine_splits=False,
          decimals=None,
      )
      short_name = CUSTOM_SCORE_FUNC_NAME
      assert ranks_and_splits["short_name"] == short_name
      assert (
          ranks_and_splits["ranks"].argmin()
          == grid_search.cv_results_[f"mean_test_{short_name}"].argmax()
      )  # NB: max because greater_is_better=True
      assert ranks_and_splits["split_train"] is None
      assert ranks_and_splits["split_test"] is None
  
      # metric is missing
      with pytest.warns(
          Warning,
          match="Metric 'MAPE' is not available in the CV results.",
      ):
          ranks_and_splits = get_ranks_and_splits(
              grid_search,
              score_func=EvaluationMetricEnum.MeanAbsolutePercentError.name,
              greater_is_better=None,
              combine_splits=True,
              decimals=None,
          )
          assert ranks_and_splits == {
              "short_name": "MAPE",
              "ranks": None,
              "split_train": None,
              "split_test": None,
          }
  
      # `warns=False`
      with pytest.warns(None):
          ranks_and_splits = get_ranks_and_splits(
              grid_search,
              score_func=EvaluationMetricEnum.MeanAbsolutePercentError.name,
              greater_is_better=None,
              combine_splits=True,
              decimals=None,
              warn_metric=False,
          )
          assert ranks_and_splits == {
              "short_name": "MAPE",
              "ranks": None,
              "split_train": None,
              "split_test": None,
          }
  
imports: import warnings
  import numpy
  import pandas
  import pytest
  from sklearn.metrics import mean_absolute_error
  from sklearn.pipeline import Pipeline
  from greykite.common.constants import FRACTION_OUTSIDE_TOLERANCE
  from greykite.common.evaluation import EvaluationMetricEnum
  from greykite.common.python_utils import assert_equal
  from greykite.common.testing_utils import generate_df_for_tests
  from greykite.framework.constants import CUSTOM_SCORE_FUNC_NAME
  from greykite.framework.constants import CV_REPORT_METRICS_ALL
  from greykite.framework.constants import FRACTION_OUTSIDE_TOLERANCE_NAME
  from greykite.framework.pipeline.pipeline import forecast_pipeline
  from greykite.framework.utils.result_summary import get_ranks_and_splits
  from greykite.framework.utils.result_summary import summarize_grid_search_results
  from greykite.sklearn.estimator.null_model import DummyEstimator
  from greykite.sklearn.estimator.silverkite_estimator import SilverkiteEstimator
label_desc: Use image node_id 1 for calling a global function with example usage: test_get_ranks_and_splits(pipeline_results) without return types