code: def test_null_transformer1(data):
      """Checks impute_algorithm='interpolate'"""
      with pytest.raises(
          ValueError, match="method 'ffill' is not allowed"
      ):
          NullTransformer(
              impute_algorithm="interpolate",
              impute_params=dict(method="ffill"),
              impute_all=False,
          )
  
      # impute_all=False leaves NaNs
      impute_params = dict(method="linear", limit_direction="forward")
      null_transform = NullTransformer(
          max_frac=0.8,
          impute_algorithm="interpolate",
          impute_params=impute_params,
          impute_all=False,
      )
      # init does not modify parameters
      assert null_transform.max_frac == 0.8
      assert null_transform.impute_algorithm == "interpolate"
      assert null_transform.impute_params == impute_params
      assert null_transform.impute_all is False
      null_transform.fit(data)
      assert null_transform.impute_params == {
          "axis": 0,
          **impute_params,
      }
      result = null_transform.transform(data)
      expected = pd.DataFrame(
          {
              "a": (0.0, -0.5, -1.0, 1.0),
              "b": (np.nan, 2.0, 2.0, 2.0),
              "c": (2.0, 3.0, 6.0, 9.0),
              "d": (np.nan, 4.0, -4.0, 16.0),
          }
      )
      assert_equal(result, expected)
      assert null_transform.missing_info is None
  
      # impute_all=True fills NaNs
      null_transform = NullTransformer(
          impute_algorithm="interpolate",
          impute_params=dict(
              method="linear", limit_direction="forward"
          ),
          impute_all=True,
      )
      result = null_transform.fit_transform(data)
      expected = pd.DataFrame(
          {
              "a": (0.0, -0.5, -1.0, 1.0),
              "b": (2.0, 2.0, 2.0, 2.0),
              "c": (2.0, 3.0, 6.0, 9.0),
              "d": (4.0, 4.0, -4.0, 16.0),
          }
      )
      assert_equal(result, expected)
  
file_path: greykite/greykite/tests/sklearn/transform/test_null_transformer.py
imports: import numpy
  import pandas
  import pytest
  from sklearn.exceptions import NotFittedError
  from testfixtures import LogCapture
  from greykite.common.constants import LOGGER_NAME
  from greykite.common.python_utils import assert_equal
  from greykite.sklearn.transform.null_transformer import NullTransformer
label_desc: Use image node_id 2 for calling a global function with example usage: test_null_transformer1(data) without return types