code: def test_TimeSeriesGenerator_doesnt_miss_any_sample():
      x = np.array([[i] for i in range(10)])
  
      for length in range(3, 10):
          g = sequence.TimeseriesGenerator(
              x, x, length=length, batch_size=1
          )
          expected = max(0, len(x) - length)
          actual = len(g)
  
          assert expected == actual
  
          if len(g) > 0:
              # All elements in range(length, 10) should be used as current step
              expected = np.arange(length, 10).reshape(-1, 1)
  
              y = np.concatenate(
                  [g[ix][1] for ix in range(len(g))], axis=0
              )
              assert_allclose(y, expected)
  
      x = np.array([[i] for i in range(23)])
  
      strides = (1, 1, 5, 7, 3, 5, 3)
      lengths = (3, 3, 4, 3, 1, 3, 7)
      batch_sizes = (6, 6, 6, 5, 6, 6, 6)
      shuffles = (False, True, True, False, False, False, False)
  
      for stride, length, batch_size, shuffle in zip(
          strides, lengths, batch_sizes, shuffles
      ):
          g = sequence.TimeseriesGenerator(
              x,
              x,
              length=length,
              sampling_rate=1,
              stride=stride,
              start_index=0,
              end_index=None,
              shuffle=shuffle,
              reverse=False,
              batch_size=batch_size,
          )
          if shuffle:
              # all batches have the same size when shuffle is True.
              expected_sequences = (
                  ceil((23 - length) / float(batch_size * stride))
                  * batch_size
              )
          else:
              # last batch will be different if `(samples - length) / stride`
              # is not a multiple of `batch_size`.
              expected_sequences = ceil((23 - length) / float(stride))
  
          expected_batches = ceil(
              expected_sequences / float(batch_size)
          )
  
          y = [g[ix][1] for ix in range(len(g))]
  
          actual_sequences = sum(len(_y) for _y in y)
          actual_batches = len(y)
  
          assert expected_sequences == actual_sequences
          assert expected_batches == actual_batches
  
file_path: keras-preprocessing/tests/sequence_test.py
imports: from math import ceil
  import numpy
  import pytest
  from numpy.testing import assert_allclose, assert_equal, assert_raises
  from keras_preprocessing import sequence
label_desc: Use image node_id 9 for calling a global function with example usage: test_TimeSeriesGenerator_doesnt_miss_any_sample() without return types