code: def test_lda_priors():
      # Test priors (negative priors)
      priors = np.array([0.5, -0.5])
      clf = LinearDiscriminantAnalysis(priors=priors)
      msg = "priors must be non-negative"
  
      with pytest.raises(ValueError, match=msg):
          clf.fit(X, y)
  
      # Test that priors passed as a list are correctly handled (run to see if
      # failure)
      clf = LinearDiscriminantAnalysis(priors=[0.5, 0.5])
      clf.fit(X, y)
  
      # Test that priors always sum to 1
      priors = np.array([0.5, 0.6])
      prior_norm = np.array([0.45, 0.55])
      clf = LinearDiscriminantAnalysis(priors=priors)
  
      with pytest.warns(UserWarning):
          clf.fit(X, y)
  
      assert_array_almost_equal(clf.priors_, prior_norm, 2)
  
imports: import numpy
  import pytest
  from scipy import linalg
  from sklearn.cluster import KMeans
  from sklearn.covariance import LedoitWolf, ShrunkCovariance, ledoit_wolf
  from sklearn.datasets import make_blobs
  from sklearn.discriminant_analysis import LinearDiscriminantAnalysis, QuadraticDiscriminantAnalysis, _cov
  from sklearn.preprocessing import StandardScaler
  from sklearn.utils import _IS_WASM, check_random_state
  from sklearn.utils._testing import _convert_container, assert_allclose, assert_almost_equal, assert_array_almost_equal, assert_array_equal
label_desc: Use image node_id 3 for calling a global function with example usage: test_lda_priors() without return types