code: def test_TimeseriesGenerator_serde():
      data = np.array([[i] for i in range(50)])
      targets = np.array([[i] for i in range(50)])
  
      data_gen = sequence.TimeseriesGenerator(
          data, targets, length=10, sampling_rate=2, batch_size=2
      )
      json_gen = data_gen.to_json()
      recovered_gen = sequence.timeseries_generator_from_json(json_gen)
  
      assert data_gen.batch_size == recovered_gen.batch_size
      assert data_gen.end_index == recovered_gen.end_index
      assert data_gen.length == recovered_gen.length
      assert data_gen.reverse == recovered_gen.reverse
      assert data_gen.sampling_rate == recovered_gen.sampling_rate
      assert data_gen.shuffle == recovered_gen.shuffle
      assert data_gen.start_index == data_gen.start_index
      assert data_gen.stride == data_gen.stride
  
      assert (data_gen.data == recovered_gen.data).all()
      assert (data_gen.targets == recovered_gen.targets).all()
  
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 7 for calling a global function with example usage: test_TimeseriesGenerator_serde() without return types