code: def test_init_IgnoredArgumentWarning_when_series_weights_is_provided_and_regressor_has_not_sample_weights():
      """
      Test IgnoredArgumentWarning is raised when weight_func is provided but the
      regressor has no argument sample_weights in his fit method.
      """
  
      def weight_func(index):  # pragma: no cover
          return np.ones_like(index)
  
      warn_msg = re.escape(
          (
              "Argument `weight_func` is ignored since regressor KNeighborsRegressor() "
              "does not accept `sample_weight` in its `fit` method."
          )
      )
      with pytest.warns(IgnoredArgumentWarning, match=warn_msg):
          ForecasterAutoregCustom(
              regressor=KNeighborsRegressor(),
              fun_predictors=create_predictors,
              window_size=5,
              weight_func=weight_func,
          )
  
file_path: skforecast/skforecast/ForecasterAutoregCustom/tests/test_init.py
imports: import re
  import pytest
  import pandas
  import numpy
  from skforecast.ForecasterAutoregCustom import ForecasterAutoregCustom
  from skforecast.exceptions import IgnoredArgumentWarning
  from sklearn.linear_model import LinearRegression
  from sklearn.neighbors import KNeighborsRegressor
label_desc: Use image node_id 7 for calling a global function with example usage: test_init_IgnoredArgumentWarning_when_series_weights_is_provided_and_regressor_has_not_sample_weights() and returns: np