code: def test_rescale_polygon(self):
      scale_factor = (0.3, 0.4)
  
      with self.assertRaises(AssertionError):
          polygons = [0, 0, 1, 0, 1, 1, 0]
          rescale_polygon(polygons, scale_factor)
  
      polygons = [0, 0, 1, 0, 1, 1, 0, 1]
      self.assertTrue(
          np.allclose(
              rescale_polygon(polygons, scale_factor, mode="div"),
              np.array(
                  [0, 0, 1 / 0.3, 0, 1 / 0.3, 1 / 0.4, 0, 1 / 0.4]
              ),
          )
      )
      self.assertTrue(
          np.allclose(
              rescale_polygon(polygons, scale_factor, mode="mul"),
              np.array([0, 0, 0.3, 0, 0.3, 0.4, 0, 0.4]),
          )
      )
  
imports: import unittest
  from itertools import chain, permutations
  import numpy
  import torch
  from shapely.geometry import MultiPolygon, Polygon
  from mmocr.utils import boundary_iou, crop_polygon, offset_polygon, poly2bbox, poly2shapely, poly_intersection, poly_iou, poly_make_valid, poly_union, polys2shapely, rescale_polygon, rescale_polygons, shapely2poly, sort_points, sort_vertex, sort_vertex8
label_desc: Use image node_id 2 for calling the TestPolygonUtils obj's underlying member method code with example usage: obj.test_rescale_polygon() without return types