code: def test_list_from_file():
      with tempfile.TemporaryDirectory() as tmpdirname:
          # test txt file
          for i, lines in enumerate(lists):
              filename = f"{tmpdirname}/{i}.txt"
              with open(filename, "w", encoding="utf-8") as f:
                  f.writelines(f"{line}\n" for line in lines)
              lines2 = list_from_file(filename, encoding="utf-8")
              lines = list(map(str, lines))
              assert len(lines) == len(lines2)
              assert all(
                  line1 == line2 for line1, line2 in zip(lines, lines2)
              )
          # test jsonl file
          for i, lines in enumerate(dicts):
              filename = f"{tmpdirname}/{i}.jsonl"
              with open(filename, "w", encoding="utf-8") as f:
                  f.writelines(f"{line}\n" for line in lines)
              lines2 = list_from_file(filename, encoding="utf-8")
              lines = list(map(str, lines))
              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 2 for calling a global function with example usage: test_list_from_file() without return types