code: def test_raises_value_error_if_sample_weights_greater_than_1d(setup):
      error_msg = re.escape("Sample weights must be 1D array or scalar")
  
      X = rng.randn(10, 5)
      y = rng.randn(10)
      sample_weights_2D = rng.randn(10, 2) ** 2 + 1
  
      reg = LinearRegression()
  
      with pytest.raises(ValueError, match=error_msg):
          reg.fit(X, y, sample_weights_2D)
  
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 4 for calling a global function with example usage: test_raises_value_error_if_sample_weights_greater_than_1d(setup) without return types