code: def test_transform_target_regressor_error():
      X, y = friedman
      # provide a transformer and functions at the same time
      regr = TransformedTargetRegressor(
          regressor=LinearRegression(),
          transformer=StandardScaler(),
          func=np.exp,
          inverse_func=np.log,
      )
      with pytest.raises(
          ValueError,
          match="'transformer' and functions 'func'/'inverse_func' cannot both be set.",
      ):
          regr.fit(X, y)
      # fit with sample_weight with a regressor which does not support it
      sample_weight = np.ones((y.shape[0],))
      regr = TransformedTargetRegressor(
          regressor=OrthogonalMatchingPursuit(),
          transformer=StandardScaler(),
      )
      with pytest.raises(
          TypeError,
          match=r"fit\(\) got an unexpected "
          "keyword argument 'sample_weight'",
      ):
          regr.fit(X, y, sample_weight=sample_weight)
      # func is given but inverse_func is not
      regr = TransformedTargetRegressor(func=np.exp)
      with pytest.raises(
          ValueError,
          match="When 'func' is provided, 'inverse_func' must also be provided",
      ):
          regr.fit(X, y)
  
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 1 for calling a global function with example usage: test_transform_target_regressor_error() without return types