code: def test_fit_and_transform(testCase):
      """Test fit the transformer and then transform."""
      s = pd.Series(
          testCase["s"],
          pd.date_range(
              start="2017-1-1", periods=len(testCase["s"]), freq="D"
          ),
      )
      model = testCase["model"](**testCase["params"])
      if testCase["pandas_bug"] and (
          parse(pd.__version__) < parse("0.25")
      ):
          with pytest.raises(PandasBugError):
              if isinstance(model, _TrainableModel):
                  model.fit(s)
              t = model.transform(s)
      else:
          if isinstance(model, _TrainableModel):
              model.fit(s)
          t = model.transform(s)
          if not isinstance(testCase["t"], dict):
              t_true = pd.Series(testCase["t"], index=s.index)
              pd.testing.assert_series_equal(
                  t, t_true, check_dtype=False
              )
          else:
              t_true = pd.DataFrame(testCase["t"], index=s.index)
              if sys.version_info[1] >= 6:
                  pd.testing.assert_frame_equal(
                      t, t_true, check_dtype=False
                  )
              else:
                  pd.testing.assert_frame_equal(
                      t.sort_index(axis=1),
                      t_true.sort_index(axis=1),
                      check_dtype=False,
                  )
  
file_path: adtk/tests/test_transformer1d.py
imports: import sys
  import pandas
  import pytest
  from packaging.version import parse
  import adtk.transformer
  from adtk._base import _TrainableModel
  from adtk._utils import PandasBugError
label_desc: Use image node_id 2 for calling a global function with example usage: test_fit_and_transform(testCase) without return types