code: def test_incompatible_number_of_components_exception():
      X = np.random.normal(0, 1, size=(100, 2))
      y = np.zeros(100)
  
      ncm = [1, 2, 3]
      clf = GMMBayes(ncm)
  
      with pytest.raises(Exception) as e:
          assert clf.fit(X, y)
  
      assert str(e.value) == (
          "n_components must be compatible with "
          "the number of classes"
      )
  
file_path: astroML/astroML/classification/tests/test_gmm_bayes.py
imports: import numpy
  from numpy.testing import assert_allclose
  import pytest
  from astroML.classification import GMMBayes
label_desc: Use image node_id 4 for calling a global function with example usage: test_incompatible_number_of_components_exception() without return types