code: def test_linear_regression_positive():
      # Test nonnegative LinearRegression on a simple dataset.
      X = [[1], [2]]
      y = [1, 2]
  
      reg = LinearRegression(positive=True)
      reg.fit(X, y)
  
      assert_array_almost_equal(reg.coef_, [1])
      assert_array_almost_equal(reg.intercept_, [0])
      assert_array_almost_equal(reg.predict(X), [1, 2])
  
      # test it also for degenerate input
      X = [[1]]
      y = [0]
  
      reg = LinearRegression(positive=True)
      reg.fit(X, y)
      assert_allclose(reg.coef_, [0])
      assert_allclose(reg.intercept_, [0])
      assert_allclose(reg.predict(X), [0])
  
imports: import warnings
  import numpy
  import pytest
  from scipy import linalg, sparse
  from sklearn.datasets import load_iris, make_regression, make_sparse_uncorrelated
  from sklearn.linear_model import LinearRegression
  from sklearn.linear_model._base import _preprocess_data, _rescale_data, make_dataset
  from sklearn.preprocessing import add_dummy_feature
  from sklearn.utils._testing import assert_allclose, assert_array_almost_equal, assert_array_equal
  from sklearn.utils.fixes import COO_CONTAINERS, CSC_CONTAINERS, CSR_CONTAINERS, LIL_CONTAINERS
label_desc: Use image node_id 10 for calling a global function with example usage: test_linear_regression_positive() without return types