code: def test_random_resize(self, mock_sample):
      randresize = RandomResize(
          scale=(500, 500),
          ratio_range=(0.8, 1.2),
          resize_type="mmocr.Resize",
          keep_ratio=True,
      )
      target_bboxes = np.array([0, 0, 90, 150])
      target_polygons = [np.array([0, 0, 300, 0, 300, 150, 0, 150])]
  
      mock_sample.side_effect = [1.0]
      results = randresize(self.data_info1)
  
      self.assertEqual(results["img"].shape, (450, 600, 3))
      self.assertEqual(results["img_shape"], (450, 600))
      self.assertEqual(results["keep_ratio"], True)
      self.assertEqual(results["scale"], (600, 600))
      self.assertEqual(
          results["scale_factor"], (600.0 / 400.0, 450.0 / 300.0)
      )
  
      self.assertTrue(
          poly2shapely(bbox2poly(results["gt_bboxes"][0])).equals(
              poly2shapely(bbox2poly(target_bboxes))
          )
      )
      self.assertTrue(
          poly2shapely(results["gt_polygons"][0]).equals(
              poly2shapely(target_polygons[0])
          )
      )
  
imports: import copy
  import unittest
  import unittest.mock
  import numpy
  from mmcv.transforms import Pad, RandomResize
  from mmocr.datasets.transforms import BoundedScaleAspectJitter, RandomCrop, RandomFlip, Resize, ShortScaleAspectJitter, SourceImagePad, TextDetRandomCrop, TextDetRandomCropFlip
  from mmocr.utils import bbox2poly, poly2shapely
label_desc: Use image node_id 2 for calling the TestRandomResize obj's underlying member method code with example usage: obj.test_random_resize(mock_sample) without return types