code: def test_poly2shapely(self):
      polygon = Polygon([[0, 0], [1, 0], [1, 1], [0, 1]])
      # test np.array
      poly = np.array([0, 0, 1, 0, 1, 1, 0, 1])
      self.assertEqual(poly2shapely(poly), polygon)
      # test list
      poly = [0, 0, 1, 0, 1, 1, 0, 1]
      self.assertEqual(poly2shapely(poly), polygon)
      # test tensor
      poly = torch.Tensor([0, 0, 1, 0, 1, 1, 0, 1])
      self.assertEqual(poly2shapely(poly), polygon)
      # test invalid
      poly = [0, 0, 1]
      with self.assertRaises(AssertionError):
          poly2shapely(poly)
      poly = [0, 0, 1, 0, 1, 1, 0, 1, 1]
      with self.assertRaises(AssertionError):
          poly2shapely(poly)
  
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 5 for calling the TestPolygonUtils obj's underlying member method code with example usage: obj.test_poly2shapely() without return types