code: def test_2355():
      # Create a test PDF with toc.
      doc = fitz.Document()
      for _ in range(10):
          doc.new_page(doc.page_count)
      doc.set_toc([[1, "test", 1], [1, "test2", 5]])
  
      path = "test_2355.pdf"
      doc.save(path)
  
      # Open many times
      for i in range(10):
          with fitz.open(path) as new_doc:
              new_doc.get_toc()
  
      # Open once and read many times
      with fitz.open(path) as new_doc:
          for i in range(10):
              new_doc.get_toc()
  
file_path: pymudf/tests/test_toc.py
imports: import os
  import sys
  import fitz
label_desc: Use image node_id 7 for calling a global function with example usage: test_2355() without return types