docstr: Test that the window parameter can support offset of pandas.Timedelta
docstr_tok: ["Test","that","the","window","parameter","can","support","offset","of","pandas.Timedelta"]
code: def test_window_transformer_offset_parameter(self):
      """
      Test that the window parameter can support offset of pandas.Timedelta
      """
      base_parameters = {
          "function": "mean",
          "components": ["0"],
          "mode": "rolling",
      }
  
      offset_parameters = base_parameters.copy()
      offset_parameters.update({"window": pd.Timedelta(hours=4)})
      offset_transformer = WindowTransformer(
          transforms=offset_parameters,
      )
      offset_transformed = offset_transformer.transform(
          self.target_hourly
      )
  
      integer_parameters = base_parameters.copy()
      integer_parameters.update({"window": 4})
      integer_transformer = WindowTransformer(
          transforms=integer_parameters,
      )
      integer_transformed = integer_transformer.transform(
          self.target_hourly
      )
      np.testing.assert_equal(
          integer_transformed.values(), offset_transformed.values()
      )
      assert (
          offset_transformed.components[0]
          == "rolling_mean_0 days 04:00:00_0"
      )
      assert integer_transformed.components[0] == "rolling_mean_4_0"
  
      invalid_parameters = base_parameters.copy()
      invalid_parameters.update({"window": pd.DateOffset(hours=4)})
      invalid_transformer = WindowTransformer(
          transforms=invalid_parameters,
      )
      # if pd.DateOffset, raise ValueError of non-fixed frequency
      with pytest.raises(ValueError):
          invalid_transformer.transform(self.target_hourly)
  
file_path: darts/darts/tests/dataprocessing/transformers/test_window_transformations.py
imports: import itertools
  import numpy
  import pandas
  import pytest
  from darts import TimeSeries
  from darts.dataprocessing.pipeline import Pipeline
  from darts.dataprocessing.transformers import Mapper, WindowTransformer
label_desc: Use image node_id 2 for calling the TestWindowTransformer obj's underlying member method code with example usage: obj.test_window_transformer_offset_parameter() without return types