Skip to content

Commit

Permalink
Various smaller places
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinThoma committed Dec 24, 2023
1 parent 3b64cb4 commit 32f6e5a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 14 deletions.
2 changes: 1 addition & 1 deletion tests/bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def merge():
writer.add_metadata({"author": "Martin Thoma"})
writer.add_named_destination("title", 0)
writer.set_page_layout("/SinglePage")
writer.set_page_mode("/UseThumbs")
writer.page_mode = "/UseThumbs"

write_path = "dont_commit_merged.pdf"
writer.write(write_path)
Expand Down
16 changes: 5 additions & 11 deletions tests/test_workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,20 +268,14 @@ def test_extract_textbench(enable, url, pages, print_result=False):
@pytest.mark.slow()
def test_orientations():
p = PdfReader(RESOURCE_ROOT / "test Orient.pdf").pages[0]
with pytest.warns(DeprecationWarning):
p.extract_text("", "")
with pytest.warns(DeprecationWarning):
p.extract_text("", "", 0)
with pytest.warns(DeprecationWarning):
p.extract_text("", "", 0, 200)

with pytest.warns(DeprecationWarning):
p.extract_text(Tj_sep="", TJ_sep="")
p.extract_text("", "")
p.extract_text("", "", 0)
p.extract_text("", "", 0, 200)
p.extract_text()
assert findall("\\((.)\\)", p.extract_text()) == ["T", "B", "L", "R"]
with pytest.raises(Exception):
p.extract_text(None)
with pytest.raises(Exception):
p.extract_text("", 0)
p.extract_text("", 0)
with pytest.raises(Exception):
p.extract_text("", "", None)
with pytest.raises(Exception):
Expand Down
4 changes: 2 additions & 2 deletions tests/test_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,9 @@ def writer_operate(writer: PdfWriter) -> None:
writer.page_layout = NameObject("/SinglePage")
assert writer._get_page_layout() == "/SinglePage"
assert writer._get_page_mode() is None
writer.set_page_mode("/UseNone")
writer.page_mode = "/UseNone"
assert writer._get_page_mode() == "/UseNone"
writer.set_page_mode(NameObject("/UseOC"))
writer.page_mode = NameObject("/UseOC")
assert writer._get_page_mode() == "/UseOC"
writer.insert_blank_page(width=100, height=100)
writer.insert_blank_page() # without parameters
Expand Down

0 comments on commit 32f6e5a

Please sign in to comment.