code: def test_kshapes():
      """Test implementation of Kshapes."""
      X_train, y_train = load_basic_motions(split="train")
      X_test, y_test = load_basic_motions(split="test")
  
      kshapes = TimeSeriesKShapes(random_state=1, n_clusters=3)
      kshapes.fit(X_train)
      test_shape_result = kshapes.predict(X_test)
      score = kshapes.score(X_test)
      proba = kshapes.predict_proba(X_test)
  
      assert np.array_equal(test_shape_result, expected_results)
      np.testing.assert_almost_equal(score, expected_score)
      assert kshapes.n_iter_ == expected_iters
      assert np.array_equal(kshapes.labels_, expected_labels)
      assert proba.shape == (40, 3)
  
      for val in proba:
          assert np.count_nonzero(val == 1.0) == 1
  
imports: import numpy
  import pytest
  from sktime.clustering.k_shapes import TimeSeriesKShapes
  from sktime.datasets import load_basic_motions
  from sktime.tests.test_switch import run_test_for_class
label_desc: Use image node_id 1 for calling a global function with example usage: test_kshapes() without return types