code: def test_silhouette_nonzero_diag(dtype):
      # Make sure silhouette_samples requires diagonal to be zero.
      # Non-regression test for #12178
  
      # Construct a zero-diagonal matrix
      dists = pairwise_distances(
          np.array([[0.2, 0.1, 0.12, 1.34, 1.11, 1.6]], dtype=dtype).T
      )
      labels = [0, 0, 0, 1, 1, 1]
  
      # small values on the diagonal are OK
      dists[2][2] = np.finfo(dists.dtype).eps * 10
      silhouette_samples(dists, labels, metric="precomputed")
  
      # values bigger than eps * 100 are not
      dists[2][2] = np.finfo(dists.dtype).eps * 1000
      with pytest.raises(ValueError, match="contains non-zero"):
          silhouette_samples(dists, labels, metric="precomputed")
  
imports: import warnings
  import numpy
  import pytest
  from numpy.testing import assert_allclose
  from scipy.sparse import issparse
  from sklearn import datasets
  from sklearn.metrics import pairwise_distances
  from sklearn.metrics.cluster import calinski_harabasz_score, davies_bouldin_score, silhouette_samples, silhouette_score
  from sklearn.metrics.cluster._unsupervised import _silhouette_reduce
  from sklearn.utils._testing import assert_array_equal
  from sklearn.utils.fixes import CSC_CONTAINERS, CSR_CONTAINERS, DOK_CONTAINERS, LIL_CONTAINERS
label_desc: Use image node_id 7 for calling a global function with example usage: test_silhouette_nonzero_diag(dtype) without return types