Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MAINT: Deduplicate Code #1022

Merged
merged 14 commits into from
Jun 29, 2022
Prev Previous commit
Next Next commit
isort
MartinThoma committed Jun 29, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 1b2feacb7e2334b4f64f7e6d394085634a5909ad
7 changes: 6 additions & 1 deletion PyPDF2/_writer.py
Original file line number Diff line number Diff line change
@@ -41,7 +41,12 @@
from ._page import PageObject, _VirtualList
from ._reader import PdfReader
from ._security import _alg33, _alg34, _alg35
from ._utils import StreamType, b_, deprecate_with_replacement, _get_max_pdf_version_header
from ._utils import (
StreamType,
_get_max_pdf_version_header,
b_,
deprecate_with_replacement,
)
from .constants import AnnotationDictionaryAttributes
from .constants import CatalogAttributes as CA
from .constants import CatalogDictionary
10 changes: 9 additions & 1 deletion tests/test_encryption.py
Original file line number Diff line number Diff line change
@@ -71,6 +71,7 @@ def test_encryption(name):
)
def test_both_password(name, user_passwd, owner_passwd):
from PyPDF2 import PasswordType

inputfile = os.path.join(RESOURCE_ROOT, "encryption", name)
ipdf = PyPDF2.PdfReader(inputfile)
assert ipdf.is_encrypted
@@ -82,7 +83,14 @@ def test_both_password(name, user_passwd, owner_passwd):
@pytest.mark.parametrize(
"names",
[
(["unencrypted.pdf", "r3-user-password.pdf", "r4-aes-user-password.pdf", "r5-user-password.pdf"]),
(
[
"unencrypted.pdf",
"r3-user-password.pdf",
"r4-aes-user-password.pdf",
"r5-user-password.pdf",
]
),
],
)
def test_encryption_merge(names):