code: def test_list_to_file():
      with tempfile.TemporaryDirectory() as tmpdirname:
          # test txt
          for i, lines in enumerate(lists):
              filename = f"{tmpdirname}/{i}.txt"
              list_to_file(filename, lines)
              lines2 = [
                  line.rstrip("\r\n")
                  for line in open(
                      filename, encoding="utf-8"
                  ).readlines()
              ]
              lines = list(map(str, lines))
              assert len(lines) == len(lines2)
              assert all(
                  line1 == line2 for line1, line2 in zip(lines, lines2)
              )
          # test jsonl
          for i, lines in enumerate(dicts):
              filename = f"{tmpdirname}/{i}.jsonl"
              list_to_file(
                  filename, [json.dumps(line) for line in lines]
              )
              lines2 = [
                  json.loads(line.rstrip("\r\n"))["text"]
                  for line in open(
                      filename, encoding="utf-8"
                  ).readlines()
              ][0]
  
              lines = list(lines[0]["text"])
              assert len(lines) == len(lines2)
              assert all(
                  line1 == line2 for line1, line2 in zip(lines, lines2)
              )
  
imports: import json
  import os
  import tempfile
  import unittest
  from mmocr.utils import check_integrity, get_md5, is_archive, list_files, list_from_file, list_to_file
label_desc: Use image node_id 1 for calling a global function with example usage: test_list_to_file() without return types