code: def test_transform(self):
      # Test empty transform
      imgaug_transform = ImgAugWrapper(fix_poly_trans=None)
      results = self._create_dummy_data()
      origin_results = copy.deepcopy(results)
      results = imgaug_transform(results)
      self.assert_result_equal(
          results,
          origin_results["gt_polygons"],
          origin_results["gt_bboxes"],
          origin_results["gt_bboxes_labels"],
          origin_results["gt_ignored"],
          origin_results["gt_texts"],
      )
  
      args = [dict(cls="Affine", translate_px=dict(x=-10, y=-10))]
      imgaug_transform = ImgAugWrapper(args, fix_poly_trans=None)
      results = self._create_dummy_data()
      results = imgaug_transform(results)
  
      # Polygons and bboxes are partially outside the image after
      # transformation
      poly_target = [
          np.array([0, 0, 40, 0, 40, 40, 0, 40]),
          np.array([10, 10, 40, 10, 40, 40, 10, 40]),
      ]
      box_target = np.array([[0, 0, 40, 40], [10, 10, 40, 40]])
      label_target = np.array([0, 1], dtype=np.int64)
      ignored = np.array([False, True], dtype=bool)
      texts = ["text1", "text2"]
      self.assert_result_equal(
          results, poly_target, box_target, label_target, ignored, texts
      )
  
      # Some polygons and bboxes are no longer inside the image after
      # transformation
      args = [
          dict(cls="Affine", translate_px=dict(x=30, y=30)),
          ["Fliplr", 1],
      ]
      poly_target = [np.array([0, 30, 20, 30, 20, 50, 0, 50])]
      box_target = np.array([[0, 30, 20, 50]])
      label_target = np.array([0], dtype=np.int64)
      ignored = np.array([False], dtype=bool)
      texts = ["text1"]
      imgaug_transform = ImgAugWrapper(args, fix_poly_trans=None)
      results = self._create_dummy_data()
      results = imgaug_transform(results)
      self.assert_result_equal(
          results, poly_target, box_target, label_target, ignored, texts
      )
  
      # All polygons and bboxes are no longer inside the image after
      # transformation
  
      # When some transforms result in empty polygons
      args = [dict(cls="Affine", translate_px=dict(x=100, y=100))]
      results = self._create_dummy_data()
      invalid_transform = ImgAugWrapper(args)
      results = invalid_transform(results)
      self.assertIsNone(results)
  
      # Everything should work well without gt_texts
      results = self._create_dummy_data()
      del results["gt_texts"]
      results = imgaug_transform(results)
      self.assertNotIn("gt_texts", results)
  
      # Everything should work well without keys required from text detection
      results = imgaug_transform(
          dict(
              img=np.random.rand(10, 20, 3),
              img_shape=(10, 20),
              gt_texts=["text1", "text2"],
          )
      )
      self.assertEqual(results["gt_texts"], ["text1", "text2"])
  
imports: import copy
  import unittest
  from typing import Dict, List, Optional
  import numpy
  from shapely.geometry import Polygon
  from mmocr.datasets.transforms import ConditionApply, ImgAugWrapper, TorchVisionWrapper
label_desc: Use image node_id 5 for calling the TestImgAug obj's underlying member method code with example usage: obj.test_transform() without return types