code: def test_function_transform():
      constant = 10
      identity = transform.FunctionTransformer()
  
      def replace(Xt, value):
          return np.ones(Xt.shape) * value
  
      custom = transform.FunctionTransformer(
          replace, func_kwargs={"value": constant}
      )
  
      # univariate ts
      X = np.random.rand(100, 10)
      y = np.ones(100)
  
      identity.fit(X, y)
      Xtrans = identity.transform(X)
      assert Xtrans is X
  
      custom.fit(X, y)
      Xtrans = custom.transform(X)
      assert np.array_equal(Xtrans, np.ones(X.shape) * constant)
  
      # multivariate ts
      X = np.random.rand(100, 10, 4)
      y = np.ones(100)
  
      identity.fit(X, y)
      Xtrans = identity.transform(X)
      assert Xtrans is X
  
      custom.fit(X, y)
      Xtrans = custom.transform(X)
      assert np.array_equal(Xtrans, np.ones(X.shape) * constant)
  
      # ts with univariate contextual data
      Xt = np.random.rand(100, 10, 4)
      Xc = np.random.rand(100)
      X = TS_Data(Xt, Xc)
      y = np.ones(100)
  
      identity.fit(X, y)
      Xtrans = identity.transform(X)
      assert Xtrans is X
  
      custom.fit(X, y)
      Xtrans = custom.transform(X)
      Xtt, Xtc = get_ts_data_parts(Xtrans)
      assert np.array_equal(Xtt, np.ones(Xt.shape) * constant)
      assert Xtc is Xc
  
      # ts with multivariate contextual data
      Xt = np.random.rand(100, 10, 4)
      Xc = np.random.rand(100, 3)
      X = TS_Data(Xt, Xc)
      y = np.ones(100)
  
      identity.fit(X, y)
      Xtrans = identity.transform(X)
      assert Xtrans is X
  
      custom.fit(X, y)
      Xtrans = custom.transform(X)
      Xtt, Xtc = get_ts_data_parts(Xtrans)
      assert np.array_equal(Xtt, np.ones(Xt.shape) * constant)
      assert Xtc is Xc
  
      # test resampling
      def resample(Xt):
          return Xt.reshape(1, -1)
  
      illegal_resampler = transform.FunctionTransformer(resample)
      X = np.random.rand(100, 10)
      y = np.ones(100)
      illegal_resampler.fit(X, y)
      with pytest.raises(ValueError):
          Xtrans = illegal_resampler.transform(X)
  
file_path: seglearn/seglearn/tests/test_transform.py
imports: import warnings
  import numpy
  import pytest
  import seglearn.transform
  from seglearn.base import TS_Data
  from seglearn.feature_functions import all_features, mean
  from seglearn.util import get_ts_data_parts
label_desc: Use image node_id 11 for calling a global function with example usage: test_function_transform() and returns: unknown, Xt