code: def test_setup():
      """Test the setup with exogenous variables"""
      length = 100
      data = pd.DataFrame(np.random.rand(length, 7))
      data.columns = "A B C D E F G".split()
      data["B"] = pd.date_range("20130101", periods=length)
      target = "A"
      index = "B"  # NOTE: When index is provided we do not need to pass seasonal_period
  
      exp = TSForecastingExperiment()
  
      ######################################
      # Univariate without exogenous ####
      ######################################
      approach_type = TSApproachTypes.UNI
      exogenous_present = TSExogenousPresent.NO
  
      # Case 1: pd.Series ----
      exp.setup(data=data[target])
      assert exp.approach_type == approach_type
      assert exp.exogenous_present == exogenous_present
      assert exp.target_param == target
      assert exp.exogenous_variables == []
  
      # Case 2: pd.DataFrame with 1 column ----
      exp.setup(data=pd.DataFrame(data[target]))
      assert exp.approach_type == approach_type
      assert exp.exogenous_present == exogenous_present
      assert exp.target_param == target
      assert exp.exogenous_variables == []
  
      # Case 3: # Target specified & correct ----
      exp.setup(data=data[target], target=target)
      assert exp.approach_type == approach_type
      assert exp.exogenous_present == exogenous_present
      assert exp.target_param == target
      assert exp.exogenous_variables == []
  
      ###################################
      # Univariate with exogenous ####
      ###################################
      approach_type = TSApproachTypes.UNI
      exogenous_present = TSExogenousPresent.YES
  
      # Case 1: `target` provided, `index` not provided, `ignore_features` not provided ----
      exp.setup(data=data, target=target)
      assert exp.approach_type == approach_type
      assert exp.exogenous_present == exogenous_present
      assert exp.target_param == target
      assert exp.exogenous_variables == ["B", "C", "D", "E", "F", "G"]
  
      # Case 2: `target` provided, `index` provided, `ignore_features` not provided ----
      exp.setup(data=data, target=target, index=index)
      assert exp.approach_type == approach_type
      assert exp.exogenous_present == exogenous_present
      assert exp.target_param == target
      assert exp.exogenous_variables == ["C", "D", "E", "F", "G"]
      # TODO: Add check for index values
  
      # Case 3: `target` provided, `index` provided, `ignore_features` provided ----
      exp.setup(
          data=data,
          target=target,
          index=index,
          ignore_features=["C", "E"],
      )
      assert exp.approach_type == approach_type
      assert exp.exogenous_present == exogenous_present
      assert exp.target_param == target
      assert exp.exogenous_variables == ["D", "F", "G"]
      # TODO: Add check for index values
  
      # Case 4: `target` provided, `index` not provided, `ignore_features` provided ----
      exp.setup(data=data, target=target, ignore_features=["C", "E"])
      assert exp.approach_type == approach_type
      assert exp.exogenous_present == exogenous_present
      assert exp.target_param == target
      assert exp.exogenous_variables == ["B", "D", "F", "G"]
  
file_path: pycaret/tests/test_time_series_exogenous.py
imports: import numpy
  import pandas
  import pytest
  from pycaret.time_series import TSForecastingExperiment
  from pycaret.utils.time_series import TSApproachTypes, TSExogenousPresent
label_desc: Use image node_id 3 for calling a global function with example usage: test_setup() without return types