code: def test_date_encoding(timeseries_data, freq):
      (train, test, target) = timeseries_data
      train, valid = train_test_split(train, random_state=42)
      data_config = DataConfig(
          target=target + ["Occupancy"],
          continuous_cols=[
              "Temperature",
              "Humidity",
              "Light",
              "CO2",
              "HumidityRatio",
          ],
          categorical_cols=[],
          date_columns=[("date", freq, "%Y-%m-%d %H:%M:%S")],
          encode_date_columns=True,
      )
      model_config_params = {"task": "regression"}
      model_config = CategoryEmbeddingModelConfig(**model_config_params)
      trainer_config = TrainerConfig(
          max_epochs=1, checkpoints=None, early_stopping=None
      )
      optimizer_config = OptimizerConfig()
  
      tabular_model = TabularModel(
          data_config=data_config,
          model_config=model_config,
          optimizer_config=optimizer_config,
          trainer_config=trainer_config,
      )
      config = tabular_model.config
      datamodule = TabularDatamodule(
          train=train,
          validation=valid,
          config=config,
      )
      datamodule.prepare_data()
      if freq != "S":
          datamodule.setup("fit")
          config = datamodule.config
          if freq == "H":
              assert (
                  "_Hour"
                  in datamodule.train_dataloader().dataset.data.columns
              )
          elif freq == "D":
              assert (
                  "_Dayofyear"
                  in datamodule.train_dataloader().dataset.data.columns
              )
          elif freq == "T":
              assert (
                  "_Minute"
                  in datamodule.train_dataloader().dataset.data.columns
              )
      elif freq == "S":
          with pytest.raises(RuntimeError):
              datamodule.setup("fit")
  
file_path: pytorch_tabular/tests/test_datamodule.py
imports: import numpy
  import pytest
  from pytorch_tabular import TabularModel
  from pytorch_tabular.config import DataConfig, OptimizerConfig, TrainerConfig
  from pytorch_tabular.models import CategoryEmbeddingModelConfig
  from pytorch_tabular.tabular_datamodule import TabularDatamodule
  from sklearn.model_selection import train_test_split
  from sklearn.preprocessing import PowerTransformer
label_desc: Use image node_id 2 for calling a global function with example usage: test_date_encoding(timeseries_data, freq) without return types