code: def test_umap_custom_distance_w_grad(nn_data):
      @numba.njit()
      def dist1(x, y):
          return np.sum(np.abs(x - y))
  
      @numba.njit()
      def dist2(x, y):
          return np.sum(np.abs(x - y)), (x - y)
  
      u = UMAP(metric=dist1, n_epochs=11)
      with pytest.warns(UserWarning) as warnings:
          u.fit(nn_data[:10])
      assert len(warnings) >= 1
  
      u = UMAP(metric=dist2, n_epochs=11)
      with pytest.warns(UserWarning) as warnings:
          u.fit(nn_data[:10])
      assert len(warnings) <= 1
  
imports: import warnings
  import numpy
  from sklearn.metrics import pairwise_distances
  import pytest
  import numba
  from umap import UMAP
  import umap.validation
label_desc: Use image node_id 30 for calling a global function with example usage: test_umap_custom_distance_w_grad(nn_data) and returns: np, np,  unknown