code: def test_stitch_boxes_into_lines(self):
      boxes = [  # regular boxes
          [0, 0, 1, 0, 1, 1, 0, 1],
          [2, 0.5, 3, 0.5, 3, 1.5, 2, 1.5],
          [3, 1.2, 4, 1.2, 4, 2.2, 3, 2.2],
          [5, 0.5, 6, 0.5, 6, 1.5, 5, 1.5],
          # irregular box
          [6, 1.5, 7, 1.25, 7, 1.75, 6, 1.75],
      ]
      raw_input = [
          {"box": boxes[i], "text": str(i)} for i in range(len(boxes))
      ]
      result = stitch_boxes_into_lines(raw_input, 1, 0.5)
      # Final lines: [0, 1], [2], [3, 4]
      # box 0, 1, 3, 4 are on the same line but box 3 is 2 pixels away from
      # box 1
      # box 3 and 4 are on the same line since the length of overlapping part
      # >= 0.5 * the y-axis length of box 5
      expected_result = [
          {"box": [0, 0, 3, 0, 3, 1.5, 0, 1.5], "text": "0 1"},
          {"box": [3, 1.2, 4, 1.2, 4, 2.2, 3, 2.2], "text": "2"},
          {"box": [5, 0.5, 7, 0.5, 7, 1.75, 5, 1.75], "text": "3 4"},
      ]
      result.sort(key=lambda x: x["box"][0])
      expected_result.sort(key=lambda x: x["box"][0])
      self.assertEqual(result, expected_result)
  
imports: import unittest
  import numpy
  import torch
  from mmocr.utils import bbox2poly, bbox_center_distance, bbox_diag_distance, bezier2polygon, is_on_same_line, rescale_bbox, rescale_bboxes, stitch_boxes_into_lines
  from mmocr.utils.bbox_utils import bbox_jitter
label_desc: Use image node_id 1 for calling the TestStitchBoxesIntoLines obj's underlying member method code with example usage: obj.test_stitch_boxes_into_lines() without return types