code: def test_linear_regression_sparse_equal_dense(
      setup, normalize, fit_intercept
  ):
      # Test that linear regression agrees between sparse and dense
      rng = check_random_state(0)
      n_samples = 200
      n_features = 2
      X = rng.randn(n_samples, n_features)
      X[X < 0.1] = 0.0
      Xcsr = sparse.csr_matrix(X)
      y = rng.rand(n_samples)
      params = dict(normalize=normalize, fit_intercept=fit_intercept)
      clf_dense = LinearRegression(**params)
      clf_sparse = LinearRegression(**params)
      clf_dense.fit(X, y)
  
      if fit_intercept is False:
          error_msg = re.escape("Does not support sparse input!")
          with pytest.raises(NotImplementedError, match=error_msg):
              clf_sparse.fit(Xcsr, y)
      else:
          error_msg = re.escape("Does not support sparse input!")
          with pytest.raises(NotImplementedError, match=error_msg):
              clf_sparse.fit(Xcsr, y)
  
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 7 for calling a global function with example usage: test_linear_regression_sparse_equal_dense(setup, normalize, fit_intercept) without return types