1
0
Fork 0

Merging upstream version 0.10.0.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-08 08:04:28 +01:00
parent 8e8c5588ab
commit bc8a047c8c
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
7 changed files with 128 additions and 73 deletions

View file

@ -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():