summaryrefslogtreecommitdiff
path: root/tests/test_sanity.py
diff options
context:
space:
mode:
authorJames R. Barlow <jim@purplerock.ca>2017-09-12 00:36:26 -0700
committerJames R. Barlow <jim@purplerock.ca>2017-09-12 00:36:26 -0700
commit475888c2c034173849e2bac331d73f820e68a417 (patch)
treef4fb6ac998e4dfb6ffd2bcc23f6c36d3e878b603 /tests/test_sanity.py
parentf8a3f4d7ff227bcbdd79df09acc3415c8ace3344 (diff)
Implement saving to a stream
Diffstat (limited to 'tests/test_sanity.py')
-rw-r--r--tests/test_sanity.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/test_sanity.py b/tests/test_sanity.py
index 5955381..63ab961 100644
--- a/tests/test_sanity.py
+++ b/tests/test_sanity.py
@@ -125,3 +125,15 @@ def test_copy_semantics(resources):
assert page['/MediaBox'][2] == mediabox[2]
+def test_save_stream(resources, outdir):
+ from io import BytesIO
+ pdf = qpdf.PDF.open(resources / 'graph.pdf')
+ pdf.save(outdir / 'nostream.pdf', static_id=True)
+
+ bio = BytesIO()
+ pdf.save(bio, static_id=True)
+ bio.seek(0)
+
+ with (outdir / 'nostream.pdf').open('rb') as saved_file:
+ saved_file_contents = saved_file.read()
+ assert saved_file_contents == bio.read() \ No newline at end of file