code: def test_poly_intersection(self):
      # test unsupported type
      with self.assertRaises(AssertionError):
          poly_intersection(0, 1)
  
      # test non-overlapping polygons
      points = [0, 0, 0, 1, 1, 1, 1, 0]
      points1 = [10, 20, 30, 40, 50, 60, 70, 80]
      points2 = [0, 0, 0, 0, 0, 0, 0, 0]  # Invalid polygon
      points3 = [0, 0, 0, 1, 1, 0, 1, 1]  # Self-intersected polygon
      points4 = [0.5, 0, 1.5, 0, 1.5, 1, 0.5, 1]
      poly = poly2shapely(points)
      poly1 = poly2shapely(points1)
      poly2 = poly2shapely(points2)
      poly3 = poly2shapely(points3)
      poly4 = poly2shapely(points4)
  
      area_inters = poly_intersection(poly, poly1)
      self.assertEqual(area_inters, 0.0)
  
      # test overlapping polygons
      area_inters = poly_intersection(poly, poly)
      self.assertEqual(area_inters, 1)
      area_inters = poly_intersection(poly, poly4)
      self.assertEqual(area_inters, 0.5)
  
      # test invalid polygons
      self.assertEqual(poly_intersection(poly2, poly2), 0)
      self.assertEqual(
          poly_intersection(poly3, poly3, invalid_ret=1), 1
      )
      self.assertEqual(
          poly_intersection(poly3, poly3, invalid_ret=None), 0.25
      )
  
      # test poly return
      _, poly = poly_intersection(poly, poly4, return_poly=True)
      self.assertTrue(isinstance(poly, Polygon))
      _, poly = poly_intersection(
          poly3, poly3, invalid_ret=None, return_poly=True
      )
      self.assertTrue(isinstance(poly, Polygon))
      _, poly = poly_intersection(
          poly2, poly3, invalid_ret=1, return_poly=True
      )
      self.assertTrue(poly is None)
  
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 9 for calling the TestPolygonUtils obj's underlying member method code with example usage: obj.test_poly_intersection() without return types