code: def test_predict_single_class(method):
      """Test return of predict/_proba in case only single class seen in fit."""
      X, y = make_classification_problem()
      y[:] = 42
      n_instances = 10
      X_test = X[:n_instances]
  
      clf = KNeighborsTimeSeriesClassifier()
  
      clf.fit(X, y)
      y_pred = getattr(clf, method)(X_test)
  
      if method == "predict":
          assert isinstance(y_pred, np.ndarray)
          assert y_pred.ndim == 1
          assert y_pred.shape == (n_instances,)
          assert all(list(y_pred == 42))
      if method == "predict_proba":
          assert isinstance(y_pred, np.ndarray)
          assert y_pred.ndim == 2
          assert y_pred.shape == (n_instances, 1)
          assert all(list(y_pred == 1))
  
imports: import pickle
  import numpy
  import pandas
  import pytest
  from sklearn.model_selection import KFold
  from sktime.classification.base import BaseClassifier
  from sktime.classification.deep_learning.base import BaseDeepClassifier
  from sktime.classification.distance_based import KNeighborsTimeSeriesClassifier
  from sktime.classification.dummy import DummyClassifier
  from sktime.utils._testing.estimator_checks import _assert_array_almost_equal
  from sktime.utils._testing.panel import _make_classification_y, _make_panel, make_classification_problem
  from sktime.utils.validation._dependencies import _check_soft_dependencies
label_desc: Use image node_id 11 for calling a global function with example usage: test_predict_single_class(method) without return types