code: def test_normalize_line_strings(self):
      coords1 = [(0, 0), (10, 0), (10, 10)]
      coords2 = [(5, 5), (15, 5), (15, 15)]
      coords3 = [(0, 0), (10, 0), (10, 10), (0, 10)]
      coords4 = [(5, 5), (15, 5), (15, 15), (5, 15)]
  
      coords1_arr = np.float32(coords1)
  
      # ----
      # None
      # ----
      lss_norm = normalization.normalize_line_strings(None)
      assert lss_norm is None
  
      # ----
      # array
      # ----
      for dt in [
          np.dtype("float32"),
          np.dtype("int16"),
          np.dtype("uint16"),
      ]:
          lss_norm = normalization.normalize_line_strings(
              coords1_arr[np.newaxis, np.newaxis, ...].astype(dt),
              shapes=[np.zeros((1, 1, 3), dtype=np.uint8)],
          )
          assert isinstance(lss_norm, list)
          assert isinstance(lss_norm[0], ia.LineStringsOnImage)
          assert len(lss_norm[0].line_strings) == 1
          assert np.allclose(
              lss_norm[0].line_strings[0].coords, coords1_arr
          )
  
      # ----
      # single LineString instance
      # ----
      lss_norm = normalization.normalize_line_strings(
          ia.LineString(coords1),
          shapes=[np.zeros((1, 1, 3), dtype=np.uint8)],
      )
      assert isinstance(lss_norm, list)
      assert isinstance(lss_norm[0], ia.LineStringsOnImage)
      assert len(lss_norm[0].line_strings) == 1
      assert np.allclose(lss_norm[0].line_strings[0].coords, coords1)
  
      # ----
      # single LineStringOnImage instance
      # ----
      lss_norm = normalization.normalize_line_strings(
          ia.LineStringsOnImage(
              [ia.LineString(coords1)], shape=(1, 1, 3)
          ),
          shapes=None,
      )
      assert isinstance(lss_norm, list)
      assert isinstance(lss_norm[0], ia.LineStringsOnImage)
      assert len(lss_norm[0].line_strings) == 1
      assert np.allclose(lss_norm[0].line_strings[0].coords, coords1)
  
      # ----
      # empty iterable
      # ----
      lss_norm = normalization.normalize_line_strings([], shapes=None)
      assert lss_norm is None
  
      # ----
      # iterable of LineStringOnImage
      # ----
      lss_norm = normalization.normalize_line_strings(
          [
              ia.LineStringsOnImage(
                  [ia.LineString(coords1)], shape=(1, 1, 3)
              ),
              ia.LineStringsOnImage(
                  [ia.LineString(coords2)], shape=(1, 1, 3)
              ),
          ],
          shapes=None,
      )
      assert isinstance(lss_norm, list)
  
      assert isinstance(lss_norm[0], ia.LineStringsOnImage)
      assert len(lss_norm[0].line_strings) == 1
      assert np.allclose(lss_norm[0].line_strings[0].coords, coords1)
  
      assert isinstance(lss_norm[1], ia.LineStringsOnImage)
      assert len(lss_norm[1].line_strings) == 1
      assert np.allclose(lss_norm[1].line_strings[0].coords, coords2)
  
      # ----
      # iterable of iterable of LineString
      # ----
      lss_norm = normalization.normalize_line_strings(
          [
              [ia.LineString(coords1), ia.LineString(coords2)],
              [ia.LineString(coords3), ia.LineString(coords4)],
          ],
          shapes=[
              np.zeros((1, 1, 3), dtype=np.uint8),
              np.zeros((1, 1, 3), dtype=np.uint8),
          ],
      )
      assert isinstance(lss_norm, list)
      assert isinstance(lss_norm[0], ia.LineStringsOnImage)
      assert isinstance(lss_norm[1], ia.LineStringsOnImage)
  
      assert len(lss_norm[0].line_strings) == 2
      assert np.allclose(lss_norm[0].line_strings[0].coords, coords1)
      assert np.allclose(lss_norm[0].line_strings[1].coords, coords2)
  
      assert len(lss_norm[1].line_strings) == 2
      assert np.allclose(lss_norm[1].line_strings[0].coords, coords3)
      assert np.allclose(lss_norm[1].line_strings[1].coords, coords4)
  
      # ----
      # iterable of iterable of iterable of (x,y)
      # ----
      lss_norm = normalization.normalize_line_strings(
          [[coords1, coords2], [coords3, coords4]],
          shapes=[
              np.zeros((1, 1, 3), dtype=np.uint8),
              np.zeros((1, 1, 3), dtype=np.uint8),
          ],
      )
      assert isinstance(lss_norm, list)
      assert isinstance(lss_norm[0], ia.LineStringsOnImage)
  
      assert len(lss_norm[0].line_strings) == 2
      assert np.allclose(lss_norm[0].line_strings[0].coords, coords1)
      assert np.allclose(lss_norm[0].line_strings[1].coords, coords2)
  
      assert len(lss_norm[0].line_strings) == 2
      assert np.allclose(lss_norm[1].line_strings[0].coords, coords3)
      assert np.allclose(lss_norm[1].line_strings[1].coords, coords4)
  
imports: from __future__ import print_function, division, absolute_import
  import sys
  import numpy
  import six.moves
  import imgaug
  import imgaug.augmentables.normalization
  from imgaug.testutils import reseed
label_desc: Use image node_id 15 for calling the TestNormalization obj's underlying member method code with example usage: obj.test_normalize_line_strings() without return types