code: def test_sliding_window():
      N = 1000
      width = 10
      ts = np.random.rand(N)
      for step in 1 + np.arange(width):
          sts = transform.sliding_window(ts, width, step)
          sts_c = transform.sliding_window(ts, width, step, "C")
          assert sts.flags.f_contiguous and sts_c.flags.c_contiguous
          assert sts.shape[1] == width and sts_c.shape[1] == width
          Nsts = 1 + (N - width) // step
          assert Nsts == sts.shape[0] and Nsts == sts_c.shape[0]
          assert np.all(np.isin(sts, ts)) and np.all(np.isin(sts_c, ts))
  
          # reconstruct the ts
          if step == 1:
              assert np.array_equal(
                  np.concatenate((sts[:, 0], sts[-1, 1:width])), ts
              )
              assert np.array_equal(
                  np.concatenate((sts_c[:, 0], sts_c[-1, 1:width])), ts
              )
  
          if step == width:
              assert np.array_equal(sts.ravel(), ts)
              assert np.array_equal(sts_c.ravel(), ts)
  
file_path: seglearn/seglearn/tests/test_transform.py
imports: import warnings
  import numpy
  import pytest
  import seglearn.transform
  from seglearn.base import TS_Data
  from seglearn.feature_functions import all_features, mean
  from seglearn.util import get_ts_data_parts
label_desc: Use image node_id 1 for calling a global function with example usage: test_sliding_window() without return types