code: def test_pad_sequences_str():
      a = [["1"], ["1", "2"], ["1", "2", "3"]]
  
      # test padding
      b = sequence.pad_sequences(
          a, maxlen=3, padding="pre", value="pad", dtype=object
      )
      assert_equal(
          b, [["pad", "pad", "1"], ["pad", "1", "2"], ["1", "2", "3"]]
      )
      b = sequence.pad_sequences(
          a, maxlen=3, padding="post", value="pad", dtype="<U3"
      )
      assert_equal(
          b, [["1", "pad", "pad"], ["1", "2", "pad"], ["1", "2", "3"]]
      )
  
      # test truncating
      b = sequence.pad_sequences(
          a, maxlen=2, truncating="pre", value="pad", dtype=object
      )
      assert_equal(b, [["pad", "1"], ["1", "2"], ["2", "3"]])
      b = sequence.pad_sequences(
          a, maxlen=2, truncating="post", value="pad", dtype="<U3"
      )
      assert_equal(b, [["pad", "1"], ["1", "2"], ["1", "2"]])
  
      with pytest.raises(
          ValueError, match="`dtype` int32 is not compatible with "
      ):
          sequence.pad_sequences(
              a, maxlen=2, truncating="post", value="pad"
          )
  
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 2 for calling a global function with example usage: test_pad_sequences_str() without return types