Skip to content

Commit

Permalink
Merge pull request #759 from chinapandaman/PPF-758
Browse files Browse the repository at this point in the history
PPF-758: fix test cases for update widget key
  • Loading branch information
chinapandaman authored Dec 5, 2024
2 parents 1115b9c + 14287e8 commit 11bc3b0
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ select = [
"YTT",
"W"
]
ignore = ["E501", "N999"]
ignore = ["E501", "N999", "TC006"]
preview = true
Binary file modified pdf_samples/scenario/issues/PPF-415-3-expected.pdf
Binary file not shown.
Binary file modified pdf_samples/scenario/issues/PPF-415-expected.pdf
Binary file not shown.
8 changes: 5 additions & 3 deletions tests/scenario/test_issues.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ def test_pdf_form_with_paragraph_fields_new_line_symbol_text(
with open(expected_path, "rb+") as f:
expected = f.read()
if os.name != "nt":
assert abs(len(obj.read()) - len(expected)) <= 1
assert len(obj.read()) == len(expected)
assert obj.read() == expected


def test_pdf_form_with_paragraph_fields_new_line_symbol_text_overflow(
Expand Down Expand Up @@ -109,7 +110,8 @@ def test_pdf_form_with_paragraph_fields_new_line_symbol_short_text(
with open(expected_path, "rb+") as f:
expected = f.read()
if os.name != "nt":
assert abs(len(obj.read()) - len(expected)) <= 1
assert len(obj.read()) == len(expected)
assert obj.read() == expected


def test_encrypted_edit_pdf_form(issue_pdf_directory, request):
Expand Down Expand Up @@ -242,7 +244,7 @@ def test_update_key(issue_pdf_directory, request):

expected_path = os.path.join(issue_pdf_directory, "733_expected.pdf")
request.config.results["expected_path"] = expected_path
request.config.results["stream"] = obj.read()
request.config.results["stream"] = obj.preview
with open(expected_path, "rb+") as f:
expected = f.read()
assert len(obj.preview) == len(expected)
Expand Down
4 changes: 2 additions & 2 deletions tests/test_functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,7 @@ def test_update_radio_key(template_with_radiobutton_stream, pdf_samples, request
obj.update_widget_key("radio_3", "RADIO")

request.config.results["expected_path"] = expected_path
request.config.results["stream"] = obj.read()
request.config.results["stream"] = obj.preview

expected = f.read()

Expand All @@ -653,7 +653,7 @@ def test_update_sejda_key(sejda_template, pdf_samples, request):
obj.update_widget_key("buyer_signed_date", "BUYER_SIGNED_DATE")

request.config.results["expected_path"] = expected_path
request.config.results["stream"] = obj.read()
request.config.results["stream"] = obj.preview

expected = f.read()

Expand Down

0 comments on commit 11bc3b0

Please sign in to comment.