code: def test_knn_kneighbors():
      """Tests kneighbors method and absence of bug #3798."""
      from sktime.utils._testing.hierarchical import _make_hierarchical
  
      Xtrain = _make_hierarchical(hierarchy_levels=(3,), n_columns=3)
      Xtest = _make_hierarchical(hierarchy_levels=(5,), n_columns=3)
  
      ytrain = pd.Series(["label_1", "label_2", "label_3"])
  
      kntsc = KNeighborsTimeSeriesClassifier(n_neighbors=1)
      kntsc.fit(Xtrain, ytrain)
  
      ret = kntsc.kneighbors(Xtest)
      assert isinstance(ret, tuple)
      assert len(ret) == 2
  
      dist, ind = ret
      assert isinstance(dist, np.ndarray)
      assert dist.shape == (5, 1)
      assert isinstance(ind, np.ndarray)
      assert ind.shape == (5, 1)
  
file_path: sktime/sktime/classification/distance_based/tests/test_time_series_neighbors.py
imports: import numpy
  import pandas
  import pytest
  from sktime.alignment.dtw_python import AlignerDTW
  from sktime.classification.distance_based._time_series_neighbors import KNeighborsTimeSeriesClassifier
  from sktime.datasets import load_unit_test
  from sktime.tests.test_switch import run_test_for_class
  from sktime.utils.validation._dependencies import _check_estimator_deps
label_desc: Use image node_id 5 for calling a global function with example usage: test_knn_kneighbors() without return types