From 40e384355da6255096bbb285861ec166f291cee1 Mon Sep 17 00:00:00 2001 From: Stefan <96178532+stefan6419846@users.noreply.github.com> Date: Wed, 28 Feb 2024 13:25:31 +0100 Subject: [PATCH] TST: Fix benchmark failures (#2481) --- tests/bench.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tests/bench.py b/tests/bench.py index 32647ee87..dcfc30a9b 100644 --- a/tests/bench.py +++ b/tests/bench.py @@ -94,7 +94,7 @@ def merge(): outline_item = writer.add_outline_item("An outline item", 0) writer.add_outline_item("deeper", 0, parent=outline_item) - writer.add_metadata({"author": "Martin Thoma"}) + writer.add_metadata({"/Author": "Martin Thoma"}) writer.add_named_destination("title", 0) writer.set_page_layout("/SinglePage") writer.page_mode = "/UseThumbs" @@ -133,10 +133,11 @@ def test_merge(benchmark): def text_extraction(pdf_path): - reader = PdfReader(pdf_path) - text = "" - for page in reader.pages: - text += page.extract_text() + with open(pdf_path, mode="rb") as fd: + reader = PdfReader(fd) + text = "" + for page in reader.pages: + text += page.extract_text() return text