summaryrefslogtreecommitdiffstats
path: root/tests/test_pydyf.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 16:10:26 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 16:10:48 +0000
commit7524799411d9ffd701ad12ded2cf0d4bc3dd5387 (patch)
treeb93faa52ac2c96dc7e6b7af8d1268f234053f5d3 /tests/test_pydyf.py
parentReleasing debian version 0.9.0-1. (diff)
downloadpydyf-7524799411d9ffd701ad12ded2cf0d4bc3dd5387.tar.xz
pydyf-7524799411d9ffd701ad12ded2cf0d4bc3dd5387.zip
Merging upstream version 0.10.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/test_pydyf.py')
-rw-r--r--tests/test_pydyf.py28
1 files changed, 26 insertions, 2 deletions
diff --git a/tests/test_pydyf.py b/tests/test_pydyf.py
index 83c260c..ff63be2 100644
--- a/tests/test_pydyf.py
+++ b/tests/test_pydyf.py
@@ -1,4 +1,5 @@
import io
+import re
import pydyf
@@ -704,11 +705,34 @@ def test_text():
''')
-def test_identifier():
+def test_no_identifier():
+ document = pydyf.PDF()
+ pdf = io.BytesIO()
+ document.write(pdf, identifier=False)
+ assert re.search(
+ b'/ID \\[\\((?P<hash>[0-9a-f]{32})\\) \\((?P=hash)\\)\\]',
+ pdf.getvalue()
+ ) is None
+
+
+def test_default_identifier():
+ document = pydyf.PDF()
+ pdf = io.BytesIO()
+ document.write(pdf, identifier=True)
+ assert re.search(
+ b'/ID \\[\\((?P<hash>[0-9a-f]{32})\\) \\((?P=hash)\\)\\]',
+ pdf.getvalue()
+ ) is not None
+
+
+def test_custom_identifier():
document = pydyf.PDF()
pdf = io.BytesIO()
document.write(pdf, identifier=b'abc')
- assert b'abc' in pdf.getvalue()
+ assert re.search(
+ b'/ID \\[\\(abc\\) \\(([0-9a-f]{32})\\)\\]',
+ pdf.getvalue()
+ ) is not None
def test_version():