code: def test_linear_regression_sparse(setup, random_state=0):
      # Test that linear regression also works with sparse data
      random_state = check_random_state(random_state)
      for i in range(10):
          n = 100
          X = sparse.eye(n, n)
          beta = random_state.rand(n)
          y = X * beta[:, np.newaxis]
          ols = LinearRegression()
  
          error_msg = re.escape("Does not support sparse input!")
          with pytest.raises(NotImplementedError, match=error_msg):
              ols.fit(X, y.ravel())
  
imports: import re
  import numpy
  import pytest
  from numpy.testing import assert_array_almost_equal, assert_array_equal, assert_almost_equal, assert_allclose
  from scipy import sparse
  from scipy import linalg
  from sklearn.datasets import make_sparse_uncorrelated, make_regression, load_iris
  from sklearn.linear_model import LinearRegression
  from sklearn.linear_model._base import make_dataset
  from sklearn.utils import check_random_state
  from ..None import LinearRegression
  from .._base import _preprocess_data, _rescale_data
label_desc: Use image node_id 6 for calling a global function with example usage: test_linear_regression_sparse(setup, random_state) without return types