code: def test_value_difference_metric(
      data, dtype, k, r, y_type, encode_label
  ):
      # Check basic feature of the metric:
      # * the shape of the distance matrix is (n_samples, n_samples)
      # * computing pairwise distance of X is the same than explicitely between
      #   X and X.
      X, y = data
      y = _convert_container(y, y_type)
      if encode_label:
          y = LabelEncoder().fit_transform(y)
  
      encoder = OrdinalEncoder(dtype=dtype)
      X_encoded = encoder.fit_transform(X)
  
      vdm = ValueDifferenceMetric(k=k, r=r)
      vdm.fit(X_encoded, y)
  
      dist_1 = vdm.pairwise(X_encoded)
      dist_2 = vdm.pairwise(X_encoded, X_encoded)
  
      np.testing.assert_allclose(dist_1, dist_2)
      assert dist_1.shape == (X.shape[0], X.shape[0])
      assert dist_2.shape == (X.shape[0], X.shape[0])
  
file_path: imbalanced-learn/imblearn/metrics/tests/test_pairwise.py
imports: import numpy
  import pytest
  from sklearn.exceptions import NotFittedError
  from sklearn.preprocessing import LabelEncoder, OrdinalEncoder
  from sklearn.utils._testing import _convert_container
  from imblearn.metrics.pairwise import ValueDifferenceMetric
label_desc: Use image node_id 2 for calling a global function with example usage: test_value_difference_metric(data, dtype, k, r, y_type, encode_label) without return types