code: def test_custom_nearest_neighbors():
      """Check that our custom nearest neighbors can be used for our internal
      duck-typing."""
  
      neareat_neighbors = _CustomNearestNeighbors(n_neighbors=3)
  
      assert not isinstance(neareat_neighbors, KNeighborsMixin)
      assert hasattr(neareat_neighbors, "kneighbors")
      assert hasattr(neareat_neighbors, "kneighbors_graph")
  
      rng = np.random.RandomState(42)
      X = rng.randn(150, 3)
      y = rng.randint(0, 2, 150)
      neareat_neighbors.fit(X, y)
  
      distances, indices = neareat_neighbors.kneighbors(X)
      assert distances.shape == (150, 3)
      assert indices.shape == (150, 3)
      np.testing.assert_allclose(distances[:, 0], 0.0)
      np.testing.assert_allclose(indices[:, 0], np.arange(150))
  
imports: import numpy
  import pytest
  from sklearn.neighbors._base import KNeighborsMixin
  from imblearn.base import SamplerMixin
  from imblearn.utils.testing import _CustomNearestNeighbors, all_estimators
label_desc: Use image node_id 2 for calling a global function with example usage: test_custom_nearest_neighbors() without return types