code: def test_transform_target_regressor_1d_transformer(X, y):
      # All transformer in scikit-learn expect 2D data. FunctionTransformer with
      # validate=False lift this constraint without checking that the input is a
      # 2D vector. We check the consistency of the data shape using a 1D and 2D y
      # array.
      transformer = FunctionTransformer(
          func=lambda x: x + 1, inverse_func=lambda x: x - 1
      )
      regr = TransformedTargetRegressor(
          regressor=LinearRegression(), transformer=transformer
      )
      y_pred = regr.fit(X, y).predict(X)
      assert y.shape == y_pred.shape
      # consistency forward transform
      y_tran = regr.transformer_.transform(y)
      _check_shifted_by_one(y, y_tran)
      assert y.shape == y_pred.shape
      # consistency inverse transform
      assert_allclose(
          y, regr.transformer_.inverse_transform(y_tran).squeeze()
      )
      # consistency of the regressor
      lr = LinearRegression()
      transformer2 = clone(transformer)
      lr.fit(X, transformer2.fit_transform(y))
      y_lr_pred = lr.predict(X)
      assert_allclose(y_pred, transformer2.inverse_transform(y_lr_pred))
      assert_allclose(regr.regressor_.coef_, lr.coef_)
  
imports: import numpy
  import pytest
  from sklearn import datasets
  from sklearn.base import BaseEstimator, TransformerMixin, clone
  from sklearn.compose import TransformedTargetRegressor
  from sklearn.dummy import DummyRegressor
  from sklearn.linear_model import LinearRegression, OrthogonalMatchingPursuit
  from sklearn.pipeline import Pipeline
  from sklearn.preprocessing import FunctionTransformer, StandardScaler
  from sklearn.utils._testing import assert_allclose, assert_no_warnings
label_desc: Use image node_id 7 for calling a global function with example usage: test_transform_target_regressor_1d_transformer(X, y) without return types