Refactor PDFium python test utilities.