code: def test_weights_lasso():
      X, y = build_dataset(n_samples=30, n_features=50, sparse_X=True)
  
      np.random.seed(0)
      weights = np.abs(np.random.randn(X.shape[1]))
  
      tol = 1e-14
      params = {"n_alphas": 10, "tol": tol}
      alphas1, coefs1, gaps1 = celer_path(
          X, y, "lasso", weights=weights, verbose=1, **params
      )
  
      alphas2, coefs2, gaps2 = celer_path(
          X.multiply(1 / weights[None, :]), y, "lasso", **params
      )
  
      assert_allclose(alphas1, alphas2)
      assert_allclose(
          coefs1, coefs2 / weights[:, None], atol=1e-4, rtol=1e-3
      )
      assert_array_less(gaps1, tol * norm(y) ** 2 / len(y))
      assert_array_less(gaps2, tol * norm(y) ** 2 / len(y))
  
      alpha = 0.001
      clf1 = Lasso(
          alpha=alpha, weights=weights, fit_intercept=False
      ).fit(X, y)
      clf2 = Lasso(alpha=alpha, fit_intercept=False).fit(
          X.multiply(1.0 / weights), y
      )
  
      assert_allclose(clf1.coef_, clf2.coef_ / weights)
  
      # weights must be > 0
      clf1.weights[0] = 0.0
      np.testing.assert_raises(ValueError, clf1.fit, X=X, y=y)
      # weights must be equal to X.shape[1]
      clf1.weights = np.ones(X.shape[1] + 1)
      np.testing.assert_raises(ValueError, clf1.fit, X=X, y=y)
  
imports: import warnings
  from itertools import product
  import numpy
  from numpy.linalg import norm
  from numpy.testing import assert_allclose, assert_array_less, assert_array_equal
  import pytest
  from sklearn.exceptions import ConvergenceWarning
  from sklearn.linear_model import LassoCV, Lasso, lasso_path
  from celer import celer_path
  from celer.dropin_sklearn import Lasso, LassoCV
  from celer.utils.testing import build_dataset
label_desc: Use image node_id 9 for calling a global function with example usage: test_weights_lasso() without return types