code: def test_mem_vec_diff_clusters():
      """
      Verify membership vector produces as many clusters as requested
      """
      # Ignore user warnings in this function
      warnings.filterwarnings("ignore", category=UserWarning)
  
      # Given a flat clustering trained for n_clusters picked by HDBSCAN,
      n_clusters_fit = None
      clusterer = HDBSCAN_flat(X, n_clusters=n_clusters_fit)
      n_clusters_fitted = n_clusters_from_labels(clusterer.labels_)
  
      # When membership_vector_flat is called with new data for some n_clusters,
      n_clusters_predict = n_clusters_fitted + 3
      memberships = membership_vector_flat(
          clusterer, X_test, n_clusters=n_clusters_predict
      )
  
      # Then the number of clusters in memberships should be as requested,
      assert memberships.shape[1] == n_clusters_predict
      # and the number of points should equal those in the test set
      assert len(memberships) == len(X_test)
      # and all probabilities are <= 1.
      assert_array_less(
          memberships, np.ones(memberships.shape) + 1.0e-14
      )
  
      # ========================================
      # Given a flat clustering for a specified n_clusters,
      n_clusters_fit = n_clusters_from_labels(clusterer.labels_) + 2
      clusterer = HDBSCAN_flat(X, n_clusters=n_clusters_fit)
  
      # When membership_vector_flat is called with new data for some n_clusters,
      n_clusters_predict = n_clusters_fit + 3
      memberships = membership_vector_flat(
          clusterer, X_test, n_clusters=n_clusters_predict
      )
  
      # Then the number of clusters in memberships should be as requested,
      assert memberships.shape[1] == n_clusters_predict
      # and the number of points should equal those in the test set
      assert len(memberships) == len(X_test)
      # and all probabilities are <= 1.
      assert_array_less(
          memberships, np.ones(memberships.shape) + 1.0e-14
      )
      return
  
file_path: hdbscan/hdbscan/tests/test_flat.py
imports: import warnings
  import numpy
  from hdbscan import HDBSCAN, approximate_predict
  from hdbscan.flat import HDBSCAN_flat, approximate_predict_flat, membership_vector_flat, all_points_membership_vectors_flat
  from sklearn.datasets import make_blobs, make_moons
  from sklearn.preprocessing import StandardScaler
  from sklearn.model_selection import train_test_split
  from sklearn.utils._testing import assert_array_equal, assert_array_less
label_desc: Use image node_id 9 for calling a global function with example usage: test_mem_vec_diff_clusters() without return types