code: def test_generate_knntriplets_k_genuine():
      """Checks the correct error raised when k_genuine is too big"""
      X, y = shuffle(*make_blobs(random_state=SEED), random_state=SEED)
  
      label, labels_count = np.unique(y, return_counts=True)
      labels_count_min = np.min(labels_count)
      (idx_smallest_label,) = np.where(labels_count == labels_count_min)
      k_genuine = labels_count_min
  
      warn_msgs = []
      for idx in idx_smallest_label:
          warn_msgs.append(
              "The class {} has {} elements, which is not sufficient "
              "to generate {} genuine neighbors as specified by "
              "k_genuine. Will generate {} genuine neighbors instead."
              "\n".format(
                  label[idx], k_genuine, k_genuine + 1, k_genuine - 1
              )
          )
  
      with pytest.warns(UserWarning) as raised_warning:
          Constraints(y).generate_knntriplets(X, k_genuine, 1)
      for warn in raised_warning:
          assert str(warn.message) in warn_msgs
  
file_path: metric-learn/test/test_constraints.py
imports: import pytest
  import numpy
  from sklearn.utils import shuffle
  from metric_learn.constraints import Constraints
  from sklearn.datasets import make_blobs
label_desc: Use image node_id 7 for calling a global function with example usage: test_generate_knntriplets_k_genuine() without return types