code: def test_lars_path_positive_constraint():
      # this is the main test for the positive parameter on the lars_path method
      # the estimator classes just make use of this function
  
      # we do the test on the diabetes dataset
  
      # ensure that we get negative coefficients when positive=False
      # and all positive when positive=True
      # for method 'lar' (default) and lasso
  
      err_msg = (
          "Positive constraint not supported for 'lar' coding method."
      )
      with pytest.raises(ValueError, match=err_msg):
          linear_model.lars_path(
              diabetes["data"],
              diabetes["target"],
              method="lar",
              positive=True,
          )
  
      method = "lasso"
      _, _, coefs = linear_model.lars_path(
          X, y, return_path=True, method=method, positive=False
      )
      assert coefs.min() < 0
  
      _, _, coefs = linear_model.lars_path(
          X, y, return_path=True, method=method, positive=True
      )
      assert coefs.min() >= 0
  
imports: import warnings
  import numpy
  import pytest
  from scipy import linalg
  from sklearn import datasets, linear_model
  from sklearn.base import clone
  from sklearn.exceptions import ConvergenceWarning
  from sklearn.linear_model import Lars, LarsCV, LassoLars, LassoLarsCV, LassoLarsIC, lars_path
  from sklearn.linear_model._least_angle import _lars_path_residues
  from sklearn.model_selection import train_test_split
  from sklearn.pipeline import make_pipeline
  from sklearn.preprocessing import StandardScaler
  from sklearn.utils._testing import TempMemmap, assert_allclose, assert_array_almost_equal, ignore_warnings
label_desc: Use image node_id 28 for calling a global function with example usage: test_lars_path_positive_constraint() without return types