code: def test_make_future_dataframe_with_regressor():
      """Checks future dataframe creation"""
      ts = UnivariateTimeSeries()
      df = pd.DataFrame(
          {
              TIME_COL: [
                  dt(2018, 1, 1, 3, 0, 0),
                  dt(2018, 1, 1, 4, 0, 0),
                  dt(2018, 1, 1, 5, 0, 0),
                  dt(2018, 1, 1, 6, 0, 0),
                  dt(2018, 1, 1, 7, 0, 0),
                  dt(2018, 1, 1, 8, 0, 0),
              ],
              VALUE_COL: [1, None, 3, None, None, None],
              "regressor1": [0.01, None, 0.014, 0.016, 0.017, None],
              "regressor2": [0.11, 0.112, 0.114, 0.116, None, None],
              "regressor3": [0.21, 0.212, 0.214, 0.216, 0.217, None],
          }
      )
      regressor_cols = [
          col for col in df.columns if col not in [TIME_COL, VALUE_COL]
      ]
  
      with pytest.warns(Warning) as record:
          ts.load_data(
              df, TIME_COL, VALUE_COL, regressor_cols=regressor_cols
          )
          assert (
              "y column of the provided time series contains null "
              "values at the end" in record[0].message.args[0]
          )
  
      # test regressor_cols from load_data
      assert ts.regressor_cols == [
          "regressor1",
          "regressor2",
          "regressor3",
      ]
  
      # tests last_date_for_fit from load_data (same as without regressor)
      assert ts.train_end_date == dt(2018, 1, 1, 5, 0, 0)
  
      # tests last_date_for_reg from load_data
      assert ts.last_date_for_reg == dt(2018, 1, 1, 7, 0, 0)
  
      # tests fit_df from load_data
      result_fit_df = ts.fit_df.reset_index(
          drop=True
      )  # fit_df's index is x_col
      expected_fit_df = df[df[TIME_COL] <= dt(2018, 1, 1, 5, 0, 0)]
      assert_frame_equal(result_fit_df, expected_fit_df)
  
      # tests fit_y
      result_fit_y = ts.fit_y.reset_index(
          drop=True
      )  # fit_y's index is x_col
      expected_fit_y = expected_fit_df[VALUE_COL]
      assert result_fit_y.equals(expected_fit_y)
  
      # with history
      result = ts.make_future_dataframe(
          periods=2, include_history=True
      ).reset_index(drop=True)
      expected = pd.DataFrame(
          {
              TIME_COL: pd.date_range(
                  start=dt(2018, 1, 1, 3, 0, 0), periods=5, freq="H"
              ),
              VALUE_COL: [1, None, 3, None, None],
              "regressor1": [0.01, None, 0.014, 0.016, 0.017],
              "regressor2": [0.11, 0.112, 0.114, 0.116, None],
              "regressor3": [0.21, 0.212, 0.214, 0.216, 0.217],
          }
      )
      assert_frame_equal(result, expected)
  
      # without history
      result = ts.make_future_dataframe(
          periods=2, include_history=False
      ).reset_index(drop=True)
      expected = pd.DataFrame(
          {
              TIME_COL: pd.date_range(
                  start=dt(2018, 1, 1, 6, 0, 0), periods=2, freq="H"
              ),
              VALUE_COL: np.repeat(np.nan, 2),
              "regressor1": [0.016, 0.017],
              "regressor2": [0.116, None],
              "regressor3": [0.216, 0.217],
          }
      )
      assert result.equals(expected)
  
      # user doesn't request any future periods
      result = ts.make_future_dataframe(
          periods=None, include_history=False
      ).reset_index(drop=True)
      expected = pd.DataFrame(
          {
              TIME_COL: pd.date_range(
                  start=dt(2018, 1, 1, 6, 0, 0), periods=2, freq="H"
              ),
              VALUE_COL: np.repeat(np.nan, 2),
              "regressor1": [0.016, 0.017],
              "regressor2": [0.116, None],
              "regressor3": [0.216, 0.217],
          }
      )
      assert result.equals(expected)
  
      # user requests fewer than the available periods
      result = ts.make_future_dataframe(
          periods=1, include_history=False
      ).reset_index(drop=True)
      expected = pd.DataFrame(
          {
              TIME_COL: pd.date_range(
                  start=dt(2018, 1, 1, 6, 0, 0), periods=1, freq="H"
              ),
              VALUE_COL: np.repeat(np.nan, 1),
              "regressor1": [0.016],
              "regressor2": [0.116],
              "regressor3": [0.216],
          }
      )
      assert result.equals(expected)
  
      # user requests more than 2 periods
      with pytest.warns(Warning) as record:
          result = ts.make_future_dataframe(
              periods=4, include_history=False
          ).reset_index(drop=True)
          expected = pd.DataFrame(
              {
                  TIME_COL: pd.date_range(
                      start=dt(2018, 1, 1, 6, 0, 0), periods=2, freq="H"
                  ),
                  VALUE_COL: np.repeat(np.nan, 2),
                  "regressor1": [0.016, 0.017],
                  "regressor2": [0.116, None],
                  "regressor3": [0.216, 0.217],
              }
          )
          assert result.equals(expected)
          assert (
              "Provided periods '4' is more than allowed ('2') due to the length of regressor columns. "
              "Using '2'." in record[0].message.args[0]
          )
  
imports: import datetime
  from datetime import datetime
  import numpy
  import pandas
  import pytest
  from pandas.testing import assert_frame_equal
  from greykite.common.constants import ADJUSTMENT_DELTA_COL
  from greykite.common.constants import END_TIME_COL
  from greykite.common.constants import METRIC_COL
  from greykite.common.constants import START_TIME_COL
  from greykite.common.constants import TIME_COL
  from greykite.common.constants import VALUE_COL
  from greykite.common.python_utils import assert_equal
  from greykite.common.testing_utils import generate_df_for_tests
  from greykite.common.testing_utils import generate_df_with_reg_for_tests
  from greykite.common.time_properties import get_canonical_data
  from greykite.common.viz.timeseries_plotting import add_groupby_column
  from greykite.framework.benchmark.data_loader_ts import DataLoaderTS
  from greykite.framework.constants import MEAN_COL_GROUP
  from greykite.framework.constants import OVERLAY_COL_GROUP
  from greykite.framework.constants import QUANTILE_COL_GROUP
  from greykite.framework.input.univariate_time_series import UnivariateTimeSeries
label_desc: Use image node_id 8 for calling a global function with example usage: test_make_future_dataframe_with_regressor() without return types