code: def test_linear_regression(setup):
      # Regular model fitting, #samples > 2, #features >= 2
      X = [[1, 1.5], [1.8, 2], [4, 5]]
      Y = [1, 2, 3]
  
      reg = LinearRegression()
      reg.fit(X, Y)
  
      model = sklearn_LR()
      model.fit(X, Y)
  
      assert_array_almost_equal(reg.coef_, model.coef_)
      assert_array_almost_equal(reg.intercept_, model.intercept_)
      assert_array_almost_equal(reg.predict(X), model.predict(X))
  
      # Regular model fitting, #samples <= 2, # features < 2
      error_msg = re.escape("Does not support singular matrix!")
  
      X = [[1], [2]]
      Y = [1, 2]
  
      reg = LinearRegression()
      reg.fit(X, Y)
  
      model = sklearn_LR()
      model.fit(X, Y)
  
      assert_array_almost_equal(reg.coef_, model.coef_)
      assert_array_almost_equal(reg.intercept_, model.intercept_)
      assert_array_almost_equal(reg.predict(X), model.predict(X))
  
      # Extra case #1: singular matrix, degenerate input
      error_msg = re.escape("Does not support singular matrix!")
  
      X = [[1]]
      Y = [0]
  
      reg = LinearRegression()
      with pytest.raises(NotImplementedError, match=error_msg):
          reg.fit(X, 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 1 for calling a global function with example usage: test_linear_regression(setup) without return types