code: def test_when_covariates_and_features_present_then_train_and_val_dfs_have_correct_shape(
      temp_model_path,
      model_type,
      prediction_length,
      known_covariates_names,
      static_features_names,
      differences,
      lags,
  ):
      item_id_to_length = {1: 30, 5: 40, 2: 25}
      data = get_data_frame_with_variable_lengths(
          item_id_to_length, covariates_names=known_covariates_names
      )
      if static_features_names:
          columns = {
              k: np.random.normal(size=len(item_id_to_length))
              for k in static_features_names
          }
          data.static_features = pd.DataFrame(
              columns, index=data.item_ids
          )
  
      feat_gen = TimeSeriesFeatureGenerator(
          target="target", known_covariates_names=known_covariates_names
      )
      data = feat_gen.fit_transform(data)
      model = model_type(
          freq=data.freq,
          path=temp_model_path,
          prediction_length=prediction_length,
          metadata=feat_gen.covariate_metadata,
          hyperparameters={
              "differences": differences,
              "lags": lags,
              "tabular_hyperparameters": {"DUMMY": {}},
          },
      )
      # Initialize model._target_lags and model._date_features from freq
      model.fit(train_data=data, time_limit=3)
      train_df, val_df = model._generate_train_val_dfs(data)
      expected_num_features = (
          len(lags)
          + len(known_covariates_names)
          + len(static_features_names)
          + len(model._date_features)
          + 2  # target, item_id
      )
      # sum(differences) rows  dropped per item, prediction_length rows are reserved for validation
      expected_num_train_rows = (
          len(data)
          - (sum(differences) + model.prediction_length)
          * data.num_items
      )
      expected_num_val_rows = data.num_items * model.prediction_length
      assert train_df.shape == (
          expected_num_train_rows,
          expected_num_features,
      )
      assert val_df.shape == (
          expected_num_val_rows,
          expected_num_features,
      )
  
file_path: autogluon/timeseries/tests/unittests/models/test_mlforecast.py
imports: from unittest import mock
  import numpy
  import pandas
  import pytest
  from autogluon.timeseries import TimeSeriesDataFrame
  from autogluon.timeseries.models.autogluon_tabular.mlforecast import DirectTabularModel, RecursiveTabularModel
  from autogluon.timeseries.utils.features import TimeSeriesFeatureGenerator
  from autogluon.timeseries.utils.forecast import get_forecast_horizon_index_ts_dataframe
  from ..common import DATAFRAME_WITH_COVARIATES, DATAFRAME_WITH_STATIC, DUMMY_VARIABLE_LENGTH_TS_DATAFRAME, get_data_frame_with_variable_lengths
label_desc: Use image node_id 1 for calling a global function with example usage: test_when_covariates_and_features_present_then_train_and_val_dfs_have_correct_shape(temp_model_path, model_type, prediction_length, known_covariates_names, static_features_names, differences, lags) without return types