code: def test_model_error_returns_nan():
      with mock.patch("sklearn.base.clone", lambda x: x):
          mock_model = mock.MagicMock()
  
          def mock_fit(*args, **kwargs):
              raise ValueError()
  
          mock_model.fit = mock_fit
  
          with pytest.warns(ModelFitWarning):
              scores = cross_val_score(
                  mock_model,
                  y,
                  scoring="mean_squared_error",
                  cv=SlidingWindowForecastCV(
                      window_size=100, step=24, h=1
                  ),
                  verbose=0,
              )
  
          assert np.isnan(scores).all()
  
          # if the error_score is 'raise', we will raise
          with pytest.raises(ValueError):
              cross_val_score(
                  mock_model,
                  y,
                  scoring="mean_squared_error",
                  cv=SlidingWindowForecastCV(
                      window_size=100, step=24, h=1
                  ),
                  verbose=0,
                  error_score="raise",
              )
  
file_path: pmdarima/pmdarima/model_selection/tests/test_validation.py
imports: from pmdarima.arima import ARIMA
  from pmdarima.warnings import ModelFitWarning
  from pmdarima.compat.pytest import pytest_error_str
  from pmdarima.pipeline import Pipeline
  from pmdarima.preprocessing import FourierFeaturizer
  from pmdarima.model_selection._split import RollingForecastCV, SlidingWindowForecastCV
  from pmdarima.model_selection._validation import cross_val_score, _check_scoring, cross_validate, cross_val_predict, _check_averaging
  from pmdarima.datasets import load_airpassengers
  import pytest
  import numpy
  from unittest import mock
label_desc: Use image node_id 6 for calling a global function with example usage: test_model_error_returns_nan() without return types