code: def test_pdf_append(tmp_path):
      # make a PDF file
      pdf_filename = helper_save_as_pdf(
          tmp_path, "RGB", producer="PdfParser"
      )
  
      # open it, check pages and info
      with PdfParser.PdfParser(pdf_filename, mode="r+b") as pdf:
          assert len(pdf.pages) == 1
          assert len(pdf.info) == 4
          assert (
              pdf.info.Title
              == os.path.splitext(os.path.basename(pdf_filename))[0]
          )
          assert pdf.info.Producer == "PdfParser"
          assert b"CreationDate" in pdf.info
          assert b"ModDate" in pdf.info
          check_pdf_pages_consistency(pdf)
  
          # append some info
          pdf.info.Title = "abc"
          pdf.info.Author = "def"
          pdf.info.Subject = "ghi\uABCD"
          pdf.info.Keywords = "qw)e\\r(ty"
          pdf.info.Creator = "hopper()"
          pdf.start_writing()
          pdf.write_xref_and_trailer()
  
      # open it again, check pages and info again
      with PdfParser.PdfParser(pdf_filename) as pdf:
          assert len(pdf.pages) == 1
          assert len(pdf.info) == 8
          assert pdf.info.Title == "abc"
          assert b"CreationDate" in pdf.info
          assert b"ModDate" in pdf.info
          check_pdf_pages_consistency(pdf)
  
      # append two images
      mode_cmyk = hopper("CMYK")
      mode_p = hopper("P")
      mode_cmyk.save(
          pdf_filename,
          append=True,
          save_all=True,
          append_images=[mode_p],
      )
  
      # open the PDF again, check pages and info again
      with PdfParser.PdfParser(pdf_filename) as pdf:
          assert len(pdf.pages) == 3
          assert len(pdf.info) == 8
          assert PdfParser.decode_text(pdf.info[b"Title"]) == "abc"
          assert pdf.info.Title == "abc"
          assert pdf.info.Producer == "PdfParser"
          assert pdf.info.Keywords == "qw)e\\r(ty"
          assert pdf.info.Subject == "ghi\uABCD"
          assert b"CreationDate" in pdf.info
          assert b"ModDate" in pdf.info
          check_pdf_pages_consistency(pdf)
  
imports: from __future__ import annotations
  import io
  import os
  import os.path
  import tempfile
  import time
  import pytest
  from PIL import Image, PdfParser, features
  from .helper import hopper, mark_if_feature_version, skip_unless_feature
label_desc: Use image node_id 14 for calling a global function with example usage: test_pdf_append(tmp_path) without return types