Skip to content

Commit

Permalink
TST: Writer exception non-binary stream
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinThoma committed Aug 8, 2022
1 parent c3c807a commit 1591784
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/test_writer.py
Expand Up @@ -21,6 +21,20 @@
EXTERNAL_ROOT = Path(PROJECT_ROOT) / "sample-files"


def test_writer_exception_non_binary(tmp_path, caplog):
src = RESOURCE_ROOT / "pdflatex-outline.pdf"

reader = PdfReader(src)
writer = PdfWriter()
writer.add_page(reader.pages[0])

with open(tmp_path / "out.txt", "w") as fp:
with pytest.raises(TypeError):
writer.write_stream(fp)
ending = "to write to is not in binary mode. It may not be written to correctly.\n"
assert caplog.text.endswith(ending)


def test_writer_clone():
src = RESOURCE_ROOT / "pdflatex-outline.pdf"

Expand Down

0 comments on commit 1591784

Please sign in to comment.