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

DEV: Adjust string formatting to be able to use mutmut #1020

Merged
merged 3 commits into from Jun 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Expand Up @@ -25,7 +25,7 @@ testtype:
mutation-test:
mutmut run

mutmut-results:
mutation-results:
mutmut junitxml --suspicious-policy=ignore --untested-policy=ignore > mutmut-results.xml
junit2html mutmut-results.xml mutmut-results.html

Expand Down
6 changes: 5 additions & 1 deletion PyPDF2/generic.py
Expand Up @@ -565,7 +565,11 @@ def write_to_stream(
stream.write(b"(")
for c in bytearr:
if not chr(c).isalnum() and c != b" ":
stream.write(b_(rf"\{c:0>3o}"))
# This:
# stream.write(b_(rf"\{c:0>3o}"))
# gives
# https://github.com/davidhalter/parso/issues/207
stream.write(b_("\\%03o" % c))
else:
stream.write(b_(chr(c)))
stream.write(b")")
Expand Down
1 change: 1 addition & 0 deletions mutmut-test.sh
@@ -1,2 +1,3 @@
#!/bin/bash -e
pytest -x
mypy PyPDF2 --show-error-codes --disallow-untyped-defs --disallow-incomplete-defs --ignore-missing-imports
1 change: 1 addition & 0 deletions tests/test_writer.py
Expand Up @@ -291,6 +291,7 @@ def test_encrypt(use_128bit):

reader = PdfReader(tmp_filename, password="userpwd")
new_text = reader.pages[0].extract_text()
assert reader.metadata.get("/Producer") == "PyPDF2"

assert new_text == orig_text

Expand Down