Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinThoma committed Jun 19, 2022
1 parent a351a69 commit b2dd5e6
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions tests/test_merger.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,13 +233,29 @@ def test1():
os.remove("tmp-merger-do-not-commit.pdf")


def test2():
def test_sweep_recursion1():
# TODO: This test looks like an infinite loop.
url = "https://corpora.tika.apache.org/base/docs/govdocs1/924/924546.pdf"
name = "tika-924546.pdf"
reader = PdfReader(BytesIO(get_pdf_from_url(url, name=name)))
merger = PdfMerger()
merger.append(reader)
merger.write("tmp-merger-do-not-commit.pdf")
with pytest.warns(UserWarning, match="returning NullObject instead"):
merger.write("tmp-merger-do-not-commit.pdf")

# cleanup
os.remove("tmp-merger-do-not-commit.pdf")


def test_sweep_recursion2():
# TODO: This test looks like an infinite loop.
url = "https://corpora.tika.apache.org/base/docs/govdocs1/924/924794.pdf"
name = "tika-924794.pdf"
reader = PdfReader(BytesIO(get_pdf_from_url(url, name=name)))
merger = PdfMerger()
merger.append(reader)
with pytest.warns(UserWarning, match="returning NullObject instead"):
merger.write("tmp-merger-do-not-commit.pdf")

# cleanup
os.remove("tmp-merger-do-not-commit.pdf")

0 comments on commit b2dd5e6

Please sign in to comment.