code: def test_get_pattern_cols():
      cols = ["train_MSE", "test_MSE"]
  
      pattern_cols = get_pattern_cols(
          cols=cols, pos_pattern=None, neg_pattern=None
      )
      assert_equal(pattern_cols, [])
  
      pattern_cols = get_pattern_cols(
          cols=cols, pos_pattern="train", neg_pattern=None
      )
      assert_equal(pattern_cols, ["train_MSE"])
  
      pattern_cols = get_pattern_cols(
          cols=cols, pos_pattern=None, neg_pattern="train"
      )
      assert_equal(pattern_cols, [])
  
      pattern_cols = get_pattern_cols(
          cols=cols, pos_pattern=".*", neg_pattern="train"
      )
      assert_equal(pattern_cols, ["test_MSE"])
  
      pattern_cols = get_pattern_cols(
          cols=cols, pos_pattern="train", neg_pattern="train"
      )
      assert_equal(pattern_cols, [])
  
      # `feature_cols` is a real example from the sklearn/ module,
      # generated by the following code:
      #
      # from greykite.sklearn.estimator.silverkite_estimator import \
      #     SilverkiteEstimator
      # from greykite.sklearn.estimator.testing_utils import \
      #     params_components
      # from greykite.common.testing_utils import daily_data_reg
      # params_daily = params_components()
      # # removing daily seasonality terms
      # params_daily["fs_components_df"] = pd.DataFrame({
      #     "name": ["tow", "ct1"],
      #     "period": [7.0, 1.0],
      #     "order": [4, 5],
      #     "seas_names": ["weekly", "yearly"]})
      # params_daily.pop("fit_algorithm", None)
      # params_daily.pop("fit_algorithm_params", None)
      # model = SilverkiteEstimator(**params_daily)
      # # Test get_silverkite_components function (part of fit method)
      # train_df = daily_data_reg().get("train_df").copy()
      # model.fit(train_df)
      # feature_cols = model.feature_cols
      feature_cols = [
          "Intercept",
          "dow_hr[T.2_00]",
          "dow_hr[T.3_00]",
          "dow_hr[T.4_00]",
          "dow_hr[T.5_00]",
          "dow_hr[T.6_00]",
          "dow_hr[T.7_00]",
          "Q('events_New Years Day')[T.event]",
          "Q('events_Christmas Day')[T.event]",
          "Q('events_Independence Day')[T.event]",
          "Q('events_Thanksgiving')[T.event]",
          "Q('events_Labor Day')[T.event]",
          "Q('events_Memorial Day')[T.event]",
          "Q('events_Veterans Day')[T.event]",
          "Q('events_Other')[T.event]",
          "Q('events_New Years Day_minus_1')[T.event]",
          "Q('events_New Years Day_minus_2')[T.event]",
          "Q('events_New Years Day_plus_1')[T.event]",
          "Q('events_New Years Day_plus_2')[T.event]",
          "Q('events_Christmas Day_minus_1')[T.event]",
          "Q('events_Christmas Day_minus_2')[T.event]",
          "Q('events_Christmas Day_plus_1')[T.event]",
          "Q('events_Christmas Day_plus_2')[T.event]",
          "Q('events_Independence Day_minus_1')[T.event]",
          "Q('events_Independence Day_minus_2')[T.event]",
          "Q('events_Independence Day_plus_1')[T.event]",
          "Q('events_Independence Day_plus_2')[T.event]",
          "Q('events_Thanksgiving_minus_1')[T.event]",
          "Q('events_Thanksgiving_minus_2')[T.event]",
          "Q('events_Thanksgiving_plus_1')[T.event]",
          "Q('events_Thanksgiving_plus_2')[T.event]",
          "Q('events_Labor Day_minus_1')[T.event]",
          "Q('events_Labor Day_minus_2')[T.event]",
          "Q('events_Labor Day_plus_1')[T.event]",
          "Q('events_Labor Day_plus_2')[T.event]",
          "Q('events_Memorial Day_minus_1')[T.event]",
          "Q('events_Memorial Day_minus_2')[T.event]",
          "Q('events_Memorial Day_plus_1')[T.event]",
          "Q('events_Memorial Day_plus_2')[T.event]",
          "Q('events_Veterans Day_minus_1')[T.event]",
          "Q('events_Veterans Day_minus_2')[T.event]",
          "Q('events_Veterans Day_plus_1')[T.event]",
          "Q('events_Veterans Day_plus_2')[T.event]",
          "Q('events_Other_minus_1')[T.event]",
          "Q('events_Other_minus_2')[T.event]",
          "Q('events_Other_plus_1')[T.event]",
          "Q('events_Other_plus_2')[T.event]",
          "ct_sqrt",
          "ct1",
          "ct1:tod",
          "regressor1",
          "regressor2",
          "sin1_tow_weekly",
          "is_weekend[T.True]:sin1_tow_weekly",
          "cos1_tow_weekly",
          "is_weekend[T.True]:cos1_tow_weekly",
          "sin2_tow_weekly",
          "is_weekend[T.True]:sin2_tow_weekly",
          "cos2_tow_weekly",
          "is_weekend[T.True]:cos2_tow_weekly",
          "sin3_tow_weekly",
          "is_weekend[T.True]:sin3_tow_weekly",
          "cos3_tow_weekly",
          "is_weekend[T.True]:cos3_tow_weekly",
          "sin4_tow_weekly",
          "is_weekend[T.True]:sin4_tow_weekly",
          "sin1_ct1_yearly",
          "cos1_ct1_yearly",
          "sin2_ct1_yearly",
          "cos2_ct1_yearly",
          "sin3_ct1_yearly",
          "cos3_ct1_yearly",
          "sin4_ct1_yearly",
          "cos4_ct1_yearly",
          "sin5_ct1_yearly",
          "cos5_ct1_yearly",
          "changepoint0_2018_01_01_00",
          "changepoint1_2019_01_02_16",
          "changepoint2_2019_01_03_00",
          "y_lag7",
          "y_avglag_7_14_21",
          "y_avglag_7_to_14",
      ]
  
      trend_cols = get_pattern_cols(
          feature_cols, cst.TREND_REGEX, cst.SEASONALITY_REGEX
      )
      expected_trend_cols = [
          "ct_sqrt",
          "ct1",
          "ct1:tod",
          "changepoint0_2018_01_01_00",
          "changepoint1_2019_01_02_16",
          "changepoint2_2019_01_03_00",
      ]
      assert trend_cols == expected_trend_cols
  
      seasonality_cols = get_pattern_cols(
          feature_cols, cst.SEASONALITY_REGEX
      )
      expected_seasonality_cols = [
          "sin1_tow_weekly",
          "is_weekend[T.True]:sin1_tow_weekly",
          "cos1_tow_weekly",
          "is_weekend[T.True]:cos1_tow_weekly",
          "sin2_tow_weekly",
          "is_weekend[T.True]:sin2_tow_weekly",
          "cos2_tow_weekly",
          "is_weekend[T.True]:cos2_tow_weekly",
          "sin3_tow_weekly",
          "is_weekend[T.True]:sin3_tow_weekly",
          "cos3_tow_weekly",
          "is_weekend[T.True]:cos3_tow_weekly",
          "sin4_tow_weekly",
          "is_weekend[T.True]:sin4_tow_weekly",
          "sin1_ct1_yearly",
          "cos1_ct1_yearly",
          "sin2_ct1_yearly",
          "cos2_ct1_yearly",
          "sin3_ct1_yearly",
          "cos3_ct1_yearly",
          "sin4_ct1_yearly",
          "cos4_ct1_yearly",
          "sin5_ct1_yearly",
          "cos5_ct1_yearly",
      ]
      assert seasonality_cols == expected_seasonality_cols
  
      event_cols = get_pattern_cols(
          feature_cols, pos_pattern=cst.EVENT_REGEX
      )
      expected_event_cols = [
          "Q('events_New Years Day')[T.event]",
          "Q('events_Christmas Day')[T.event]",
          "Q('events_Independence Day')[T.event]",
          "Q('events_Thanksgiving')[T.event]",
          "Q('events_Labor Day')[T.event]",
          "Q('events_Memorial Day')[T.event]",
          "Q('events_Veterans Day')[T.event]",
          "Q('events_Other')[T.event]",
          "Q('events_New Years Day_minus_1')[T.event]",
          "Q('events_New Years Day_minus_2')[T.event]",
          "Q('events_New Years Day_plus_1')[T.event]",
          "Q('events_New Years Day_plus_2')[T.event]",
          "Q('events_Christmas Day_minus_1')[T.event]",
          "Q('events_Christmas Day_minus_2')[T.event]",
          "Q('events_Christmas Day_plus_1')[T.event]",
          "Q('events_Christmas Day_plus_2')[T.event]",
          "Q('events_Independence Day_minus_1')[T.event]",
          "Q('events_Independence Day_minus_2')[T.event]",
          "Q('events_Independence Day_plus_1')[T.event]",
          "Q('events_Independence Day_plus_2')[T.event]",
          "Q('events_Thanksgiving_minus_1')[T.event]",
          "Q('events_Thanksgiving_minus_2')[T.event]",
          "Q('events_Thanksgiving_plus_1')[T.event]",
          "Q('events_Thanksgiving_plus_2')[T.event]",
          "Q('events_Labor Day_minus_1')[T.event]",
          "Q('events_Labor Day_minus_2')[T.event]",
          "Q('events_Labor Day_plus_1')[T.event]",
          "Q('events_Labor Day_plus_2')[T.event]",
          "Q('events_Memorial Day_minus_1')[T.event]",
          "Q('events_Memorial Day_minus_2')[T.event]",
          "Q('events_Memorial Day_plus_1')[T.event]",
          "Q('events_Memorial Day_plus_2')[T.event]",
          "Q('events_Veterans Day_minus_1')[T.event]",
          "Q('events_Veterans Day_minus_2')[T.event]",
          "Q('events_Veterans Day_plus_1')[T.event]",
          "Q('events_Veterans Day_plus_2')[T.event]",
          "Q('events_Other_minus_1')[T.event]",
          "Q('events_Other_minus_2')[T.event]",
          "Q('events_Other_plus_1')[T.event]",
          "Q('events_Other_plus_2')[T.event]",
      ]
      assert event_cols == expected_event_cols
  
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 5 for calling a global function with example usage: test_get_pattern_cols() without return types