code: def test_fit_predict_change_state(method):
      """Test change_state flag in fit_predict, fit_predict_proba works as intended."""
      X, y = make_classification_problem()
  
      clf = KNeighborsTimeSeriesClassifier()
  
      y_pred = getattr(clf, method)(X, y, change_state=False)
      assert not clf.is_fitted
  
      y_pred_post_fit = getattr(clf, method)(X, y, change_state=True)
      assert clf.is_fitted
  
      y_pred_post_fit2 = getattr(clf, method)(X, y, change_state=False)
      assert clf.is_fitted
  
      # get output from fit and predict or predict_proba
      clf = KNeighborsTimeSeriesClassifier()
      normal_method = method.partition("_")[2]
      y_pred_normal = getattr(clf.fit(X, y), normal_method)(X)
  
      # all the above outputs should be equal
      _assert_array_almost_equal(y_pred_normal, y_pred)
      _assert_array_almost_equal(y_pred_post_fit, y_pred)
      _assert_array_almost_equal(y_pred_post_fit, y_pred_post_fit2)
  
      assert len(y_pred) == len(y)
      if method == "fit_predict_proba":
          n_cl = len(y.unique())
          assert y_pred.shape[1] == n_cl
  
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 9 for calling a global function with example usage: test_fit_predict_change_state(method) without return types