code: def test_pad_sequences():
      a = [[1], [1, 2], [1, 2, 3]]
  
      # test padding
      b = sequence.pad_sequences(a, maxlen=3, padding="pre")
      assert_allclose(b, [[0, 0, 1], [0, 1, 2], [1, 2, 3]])
      b = sequence.pad_sequences(a, maxlen=3, padding="post")
      assert_allclose(b, [[1, 0, 0], [1, 2, 0], [1, 2, 3]])
  
      # test truncating
      b = sequence.pad_sequences(a, maxlen=2, truncating="pre")
      assert_allclose(b, [[0, 1], [1, 2], [2, 3]])
      b = sequence.pad_sequences(a, maxlen=2, truncating="post")
      assert_allclose(b, [[0, 1], [1, 2], [1, 2]])
  
      # test value
      b = sequence.pad_sequences(a, maxlen=3, value=1)
      assert_allclose(b, [[1, 1, 1], [1, 1, 2], [1, 2, 3]])
  
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 1 for calling a global function with example usage: test_pad_sequences() without return types