code: def test_fe_exogenous(
      load_uni_exo_data_target, model, expected_equal
  ):
      """Test custom feature engineering for exogenous variables (applicable to all models)."""
      data, target = load_uni_exo_data_target
      fh = 12
  
      # Example: function num_above_thresh to count how many observations lie above
      # the threshold within a window of length 2, lagged by 0 periods.
      def num_above_thresh(x):
          """Count how many observations lie above threshold."""
          return np.sum((x > 0.7)[::-1])
  
      kwargs1 = {"lag_feature": {"lag": [0, 1], "mean": [[0, 4]]}}
      kwargs2 = {
          "lag_feature": {
              "lag": [0, 1],
              num_above_thresh: [[0, 2]],
              "mean": [[0, 4]],
              "std": [[0, 4]],
          }
      }
      fe_exogenous = [
          (
              "a",
              WindowSummarizer(
                  n_jobs=1,
                  target_cols=["Income"],
                  truncate="bfill",
                  **kwargs1,
              ),
          ),
          (
              "b",
              WindowSummarizer(
                  n_jobs=1,
                  target_cols=["Unemployment", "Production"],
                  truncate="bfill",
                  **kwargs2,
              ),
          ),
      ]
  
      # Baseline
      exp = TSForecastingExperiment()
      exp.setup(data=data, target=target, fh=fh, session_id=42)
      features1 = exp.get_config("X_transformed").columns
      _ = exp.create_model(model)
      metrics1 = exp.pull()
  
      # With Feature Engineering
      exp = TSForecastingExperiment()
      exp.setup(
          data=data,
          target=target,
          fh=fh,
          fe_exogenous=fe_exogenous,
          session_id=42,
      )
      features2 = exp.get_config("X_transformed").columns
      _ = exp.create_model(model)
      metrics2 = exp.pull()
  
      assert len(features1) != len(features2)
      if expected_equal:
          assert_frame_equal(metrics1, metrics2)
      else:
          assert_frame_not_equal(metrics1, metrics2)
  
file_path: pycaret/tests/test_time_series_feat_eng.py
imports: import numpy
  import pytest
  from pandas.testing import assert_frame_equal
  from sktime.transformations.series.date import DateTimeFeatures
  from sktime.transformations.series.summarize import WindowSummarizer
  from time_series_test_utils import assert_frame_not_equal
  from pycaret.time_series import TSForecastingExperiment
label_desc: Use image node_id 2 for calling a global function with example usage: test_fe_exogenous(load_uni_exo_data_target, model, expected_equal) and returns: np