code: def test_invert_normalize_line_strings(self):
      def _norm_and_invert(line_strings, images):
          return normalization.invert_normalize_line_strings(
              normalization.normalize_line_strings(
                  line_strings, shapes=images
              ),
              line_strings,
          )
  
      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
      # ----
      observed = normalization.invert_normalize_line_strings(None, None)
      assert observed is None
  
      # ----
      # single LineString instance
      # ----
      before = ia.LineString(coords1)
      after = _norm_and_invert(
          before, images=[np.zeros((1, 1, 3), dtype=np.uint8)]
      )
      assert isinstance(after, ia.LineString)
      assert np.allclose(after.coords, coords1)
  
      # ----
      # single LineStringsOnImage instance
      # ----
      before = ia.LineStringsOnImage(
          [ia.LineString(coords1)], shape=(1, 1, 3)
      )
      after = _norm_and_invert(before, images=None)
      assert isinstance(after, ia.LineStringsOnImage)
      assert len(after.line_strings) == 1
      assert np.allclose(after.line_strings[0].coords, coords1)
      assert after.shape == (1, 1, 3)
  
      # ----
      # iterable of LineStringsOnImage
      # ----
      before = [
          ia.LineStringsOnImage(
              [ia.LineString(coords1)], shape=(1, 1, 3)
          ),
          ia.LineStringsOnImage(
              [ia.LineString(coords2)], shape=(2, 1, 3)
          ),
      ]
      after = _norm_and_invert(before, images=None)
      assert isinstance(after, list)
      assert len(after) == 2
      assert isinstance(after[0], ia.LineStringsOnImage)
      assert isinstance(after[1], ia.LineStringsOnImage)
      assert np.allclose(after[0].line_strings[0].coords, coords1)
      assert np.allclose(after[1].line_strings[0].coords, coords2)
      assert after[0].shape == (1, 1, 3)
      assert after[1].shape == (2, 1, 3)
  
      # ----
      # iterable of iterable of array
      # ----
      for dt in [
          np.dtype("float32"),
          np.dtype("int16"),
          np.dtype("uint16"),
      ]:
          for images in [
              [np.zeros((1, 1, 3), dtype=np.uint8)],
              np.zeros((1, 1, 1, 3), dtype=np.uint8),
          ]:
              before = [[coords1_arr.astype(dt)]]
              after = _norm_and_invert(before, images=images)
              assert isinstance(after, list)
              assert len(after) == 1
              assert isinstance(after[0], list)
              assert len(after[0]) == 1
              assert ia.is_np_array(after[0][0])
              assert after[0][0].shape == (3, 2)
              assert after[0][0].dtype.name == dt.name
              assert np.allclose(after[0][0], coords1_arr)
  
              before = [[coords1_arr.astype(dt) for _ in sm.xrange(5)]]
              after = _norm_and_invert(before, images=images)
              assert isinstance(after, list)
              assert len(after) == 1
              assert isinstance(after[0], list)
              assert len(after[0]) == 5
              assert ia.is_np_array(after[0][0])
              assert after[0][0].shape == (3, 2)
              assert after[0][0].dtype.name == dt.name
              assert np.allclose(after[0][0], coords1_arr)
  
      # ----
      # iterable of iterable of LineString
      # ----
      before = [
          [ia.LineString(coords1), ia.LineString(coords2)],
          [ia.LineString(coords3), ia.LineString(coords4)],
      ]
      after = _norm_and_invert(
          before,
          images=[
              np.zeros((1, 1, 3), dtype=np.uint8),
              np.zeros((1, 1, 3), dtype=np.uint8),
          ],
      )
      assert isinstance(after, list)
      assert isinstance(after[0], list)
      assert isinstance(after[1], list)
      assert len(after[0]) == 2
      assert len(after[1]) == 2
      assert np.allclose(after[0][0].coords, coords1)
      assert np.allclose(after[0][1].coords, coords2)
      assert np.allclose(after[1][0].coords, coords3)
      assert np.allclose(after[1][1].coords, coords4)
  
      # ----
      # iterable of iterable of iterable of (x,y)
      # ----
      before = [[coords1, coords2], [coords3, coords4]]
      after = _norm_and_invert(
          before,
          images=[
              np.zeros((1, 1, 3), dtype=np.uint8),
              np.zeros((1, 1, 3), dtype=np.uint8),
          ],
      )
      assert isinstance(after, list)
      assert len(after) == 2
      assert len(after[0]) == 2
      assert len(after[1]) == 2
      assert after[0][0] == coords1
      assert after[0][1] == coords2
      assert after[1][0] == coords3
      assert after[1][1] == 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 8 for calling the TestNormalization obj's underlying member method code with example usage: obj.test_invert_normalize_line_strings() and returns: normalization