code: def test_create_sample_weights_exceptions_when_weights_has_nan():
      """
      Test sample_weights exception when sample_weight contains NaNs.
      """
      forecaster = ForecasterAutoregMultiSeriesCustom(
          regressor=LinearRegression(),
          fun_predictors=create_predictors,
          window_size=3,
          weight_func=custom_weights_nan,
      )
  
      err_msg = re.escape(
          "The resulting `weights` cannot have NaN values."
      )
      with pytest.raises(ValueError, match=err_msg):
          forecaster.create_sample_weights(
              series=series,
              X_train=X_train,
              y_train_index=y_train_index,
          )
  
file_path: skforecast/skforecast/ForecasterAutoregMultiSeriesCustom/tests/test_create_sample_weights.py
imports: import re
  import pytest
  import numpy
  import pandas
  from skforecast.ForecasterAutoregMultiSeriesCustom import ForecasterAutoregMultiSeriesCustom
  from sklearn.linear_model import LinearRegression
label_desc: Use image node_id 12 for calling a global function with example usage: test_create_sample_weights_exceptions_when_weights_has_nan() without return types