code: def test_knn_dict_dist(dist, get_mats, get_targets):
      n_matrices, n_channels = 6, 3
      targets = get_targets(n_matrices)
      covmats = get_mats(n_matrices, n_channels, "spd")
      with pytest.raises(KeyError):
          clf = KNearestNeighborRegressor(metric={"distance": dist})
          clf.fit(covmats, targets).predict(covmats)
  
imports: import pickle
  import numpy
  from numpy.testing import assert_array_equal
  import pytest
  from conftest import get_distances, get_means, get_metrics
  from pyriemann.regression import SVR, KNearestNeighborRegressor
  from pyriemann.utils.kernel import kernel
  from pyriemann.utils.mean import mean_covariance
label_desc: Use image node_id 5 for calling a global function with example usage: test_knn_dict_dist(dist, get_mats, get_targets) without return types