code: def test_pack_instance(self):
      packer = TextSpottingPacker(
          data_root=self.root.name, split="test"
      )
      instance = packer.pack_instance(self.sample)
      self.assertEquals(instance["img_path"], "test_img.jpg")
      self.assertEquals(instance["height"], 30)
      self.assertEquals(instance["width"], 20)
      self.assertEquals(
          instance["instances"][0]["polygon"],
          [0, 0, 0, 10, 10, 20, 20, 0],
      )
      self.assertEquals(
          instance["instances"][0]["bbox"],
          [float(x) for x in [0, 0, 20, 20]],
      )
      self.assertEquals(instance["instances"][0]["bbox_label"], 0)
      self.assertEquals(instance["instances"][0]["ignore"], False)
      self.assertEquals(instance["instances"][0]["text"], "text1")
      self.assertEquals(
          instance["instances"][1]["polygon"],
          [0.0, 0.0, 10.0, 0.0, 10.0, 20.0, 0.0, 20.0],
      )
      self.assertEquals(
          instance["instances"][1]["bbox"],
          [float(x) for x in [0, 0, 10, 20]],
      )
      self.assertEquals(instance["instances"][1]["bbox_label"], 0)
      self.assertEquals(instance["instances"][1]["ignore"], False)
      self.assertEquals(instance["instances"][1]["text"], "text2")
  
file_path: mmocr/tests/test_datasets/test_preparers/test_packers/test_textspotting_packer.py
imports: import os.path
  import tempfile
  import unittest
  import cv2
  import numpy
  from mmocr.datasets.preparers import TextSpottingPacker
label_desc: Use image node_id 2 for calling the TestTextSpottingPacker obj's underlying member method code with example usage: obj.test_pack_instance() without return types