code: def test_n_components():
      # Test that after adding n_components, result is different and
      # n_components = n_clusters by default
      X, y = make_blobs(
          n_samples=20,
          random_state=0,
          centers=[[1, 1], [-1, -1]],
          cluster_std=0.01,
      )
      sp = SpectralClustering(n_clusters=2, random_state=0)
      labels = sp.fit(X).labels_
      # set n_components = n_cluster and test if result is the same
      labels_same_ncomp = (
          SpectralClustering(
              n_clusters=2, n_components=2, random_state=0
          )
          .fit(X)
          .labels_
      )
      # test that n_components=n_clusters by default
      assert_array_equal(labels, labels_same_ncomp)
  
      # test that n_components affect result
      # n_clusters=8 by default, and set n_components=2
      labels_diff_ncomp = (
          SpectralClustering(n_components=2, random_state=0)
          .fit(X)
          .labels_
      )
      assert not np.array_equal(labels, labels_diff_ncomp)
  
imports: import pickle
  import re
  import numpy
  import pytest
  from scipy.linalg import LinAlgError
  from sklearn.cluster import SpectralClustering, spectral_clustering
  from sklearn.cluster._spectral import cluster_qr, discretize
  from sklearn.datasets import make_blobs
  from sklearn.feature_extraction import img_to_graph
  from sklearn.metrics import adjusted_rand_score
  from sklearn.metrics.pairwise import kernel_metrics, rbf_kernel
  from sklearn.neighbors import NearestNeighbors
  from sklearn.utils import check_random_state
  from sklearn.utils._testing import assert_array_equal
  from sklearn.utils.fixes import COO_CONTAINERS, CSR_CONTAINERS
label_desc: Use image node_id 9 for calling a global function with example usage: test_n_components() without return types