code: def test_hdbscan_distance_matrix():
      D = distance.squareform(distance.pdist(X))
      D /= np.max(D)
  
      labels, p, persist, ctree, ltree, mtree = hdbscan(
          D, metric="precomputed"
      )
      # number of clusters, ignoring noise if present
      n_clusters_1 = len(set(labels)) - int(
          -1 in labels
      )  # ignore noise
      assert n_clusters_1 == n_clusters
  
      labels = HDBSCAN(metric="precomputed").fit(D).labels_
      n_clusters_2 = len(set(labels)) - int(-1 in labels)
      assert n_clusters_2 == n_clusters
  
      validity = validity_index(D, labels, metric="precomputed", d=2)
      assert validity >= 0.6
  
imports: import numpy
  from scipy.spatial import distance
  from scipy import sparse
  from scipy import stats
  from sklearn.utils.estimator_checks import check_estimator
  from sklearn.utils._testing import assert_array_equal, assert_array_almost_equal, assert_raises
  from hdbscan import HDBSCAN, hdbscan, validity_index, approximate_predict, approximate_predict_scores, membership_vector, all_points_membership_vectors
  from sklearn.datasets import make_blobs
  from sklearn.utils import shuffle
  from sklearn.preprocessing import StandardScaler
  from scipy.stats import mode
  from tempfile import mkdtemp
  from functools import wraps
  import pytest
  from sklearn import datasets
  import warnings
label_desc: Use image node_id 7 for calling a global function with example usage: test_hdbscan_distance_matrix() without return types