code: def test_y_mean_attribute_regressor():
      X = [[0]] * 5
      y = [1, 2, 4, 6, 8]
      # when strategy = 'mean'
      est = DummyRegressor(strategy="mean")
      est.fit(X, y)
  
      assert est.constant_ == np.mean(y)
  
imports: import numpy
  import pytest
  import scipy.sparse
  from sklearn.base import clone
  from sklearn.dummy import DummyClassifier, DummyRegressor
  from sklearn.exceptions import NotFittedError
  from sklearn.utils._testing import assert_almost_equal, assert_array_almost_equal, assert_array_equal, ignore_warnings
  from sklearn.utils.fixes import CSC_CONTAINERS
  from sklearn.utils.stats import _weighted_percentile
label_desc: Use image node_id 26 for calling a global function with example usage: test_y_mean_attribute_regressor() without return types