code: def test_apply_func_to_columns():
      """Tests apply_func_to_columns function"""
      # cols can be index values
      row = pd.Series([1.0, 2.0, 3.0], index=["a", "b", "c"])
      fn = apply_func_to_columns(
          row_func=ElementwiseEvaluationMetricEnum.Residual.get_metric_func(),
          cols=["a", "b"],
      )
      assert fn(row) == row["a"] - row["b"]
  
      fn = apply_func_to_columns(
          row_func=ElementwiseEvaluationMetricEnum.Residual.get_metric_func(),
          cols=["c", "b"],
      )
      assert fn(row) == row["c"] - row["b"]
  
      # cols can be to dict keys
      row = {"a": 1.0, "b": 2.0, "c": 3.0}
      assert fn(row) == row["c"] - row["b"]
  
      # cols can be list indices
      row = [4.0, 8.0, 5.0]
      fn = apply_func_to_columns(
          row_func=ElementwiseEvaluationMetricEnum.Residual.get_metric_func(),
          cols=[2, 1],
      )
      assert fn(row) == row[2] - row[1]
  
imports: import warnings
  from dataclasses import dataclass
  from typing import List
  import numpy
  import pandas
  import pytest
  import scipy
  from greykite.common import constants
  from greykite.common.evaluation import ElementwiseEvaluationMetricEnum
  from greykite.common.python_utils import apply_func_to_columns
  from greykite.common.python_utils import assert_equal
  from greykite.common.python_utils import dictionaries_values_to_lists
  from greykite.common.python_utils import dictionary_values_to_lists
  from greykite.common.python_utils import flatten_list
  from greykite.common.python_utils import get_integer
  from greykite.common.python_utils import get_pattern_cols
  from greykite.common.python_utils import group_strs_with_regex_patterns
  from greykite.common.python_utils import ignore_warnings
  from greykite.common.python_utils import mutable_field
  from greykite.common.python_utils import reorder_columns
  from greykite.common.python_utils import split_offset_str
  from greykite.common.python_utils import unique_dict_in_list
  from greykite.common.python_utils import unique_elements_in_list
  from greykite.common.python_utils import unique_in_list
  from greykite.common.python_utils import update_dictionaries
  from greykite.common.python_utils import update_dictionary
label_desc: Use image node_id 13 for calling a global function with example usage: test_apply_func_to_columns() without return types