code: def test_create_train_X_y_ValueError_when_y_and_exog_have_different_index():
      """
      Test ValueError is raised when y and exog have different index.
      """
      y = pd.Series(np.arange(10), name="y")
      y.index = pd.date_range(start="2022-01-01", periods=10, freq="1D")
      forecaster = ForecasterAutoregDirect(
          LinearRegression(), lags=3, steps=3
      )
  
      err_msg = re.escape(
          (
              "Different index for `y` and `exog`. They must be equal "
              "to ensure the correct alignment of values."
          )
      )
      with pytest.raises(ValueError, match=err_msg):
          forecaster.fit(
              y=y,
              exog=pd.Series(
                  np.arange(10),
                  index=pd.RangeIndex(start=0, stop=10, step=1),
              ),
          )
  
imports: import re
  import pytest
  import numpy
  import pandas
  from skforecast.ForecasterAutoregDirect import ForecasterAutoregDirect
  from skforecast.exceptions import MissingValuesExogWarning
  from sklearn.linear_model import LinearRegression
  from sklearn.compose import ColumnTransformer
  from sklearn.preprocessing import StandardScaler
  from sklearn.preprocessing import OneHotEncoder
label_desc: Use image node_id 5 for calling a global function with example usage: test_create_train_X_y_ValueError_when_y_and_exog_have_different_index() without return types