code: def test_poly2bbox(self):
      # test np.array
      polygon = np.array([0, 0, 1, 0, 1, 1, 0, 1])
      self.assertTrue(
          np.all(poly2bbox(polygon) == np.array([0, 0, 1, 1]))
      )
      # test list
      polygon = [0, 0, 1, 0, 1, 1, 0, 1]
      self.assertTrue(
          np.all(poly2bbox(polygon) == np.array([0, 0, 1, 1]))
      )
      # test tensor
      polygon = torch.Tensor([0, 0, 1, 0, 1, 1, 0, 1])
      self.assertTrue(
          np.all(poly2bbox(polygon) == np.array([0, 0, 1, 1]))
      )
  
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 4 for calling the TestPolygonUtils obj's underlying member method code with example usage: obj.test_poly2bbox() without return types