Skip to content

Commit

Permalink
PPF-522: fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
chinapandaman committed Mar 16, 2024
1 parent 15ea144 commit 4435b55
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 48 deletions.
Binary file not shown.
Binary file not shown.
34 changes: 0 additions & 34 deletions tests/scenario/test_issues_simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,6 @@ def test_pdf_form_with_central_aligned_text_fields(issue_pdf_directory, pdf_samp
assert obj.stream == expected


def test_pdf_form_with_paragraph_fields_new_line_symbol_text(issue_pdf_directory, pdf_samples, request):
expected_path = os.path.join(pdf_samples, "simple", "scenario", "issues", "PPF-415-expected.pdf")
with open(expected_path, "rb+") as f:
obj = FormWrapper(os.path.join(issue_pdf_directory, "PPF-415.pdf")).fill(
{"Address": "Mr John Smith\n132, My Street\nKingston, New York 12401"}
)

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

expected = f.read()

if os.name == "nt":
assert len(obj.read()) == len(expected)
assert obj.stream == expected


def test_pdf_form_with_paragraph_fields_new_line_symbol_text_overflow(issue_pdf_directory, pdf_samples, request):
expected_path = os.path.join(pdf_samples, "simple", "scenario", "issues", "PPF-415-2-expected.pdf")
with open(expected_path, "rb+") as f:
Expand All @@ -61,23 +44,6 @@ def test_pdf_form_with_paragraph_fields_new_line_symbol_text_overflow(issue_pdf_
assert obj.stream == expected


def test_pdf_form_with_paragraph_fields_new_line_symbol_short_text(issue_pdf_directory, pdf_samples, request):
expected_path = os.path.join(pdf_samples, "simple", "scenario", "issues", "PPF-415-3-expected.pdf")
with open(expected_path, "rb+") as f:
obj = FormWrapper(os.path.join(issue_pdf_directory, "PPF-415.pdf")).fill(
{"Address": "J Smith\n132 A St\nNYC, NY 12401"}
)

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

expected = f.read()

if os.name == "nt":
assert len(obj.read()) == len(expected)
assert obj.stream == expected


def test_521(issue_pdf_directory, pdf_samples, request):
expected_path = os.path.join(pdf_samples, "simple", "scenario", "issues", "521-expected.pdf")
with open(expected_path, "rb+") as f:
Expand Down
5 changes: 3 additions & 2 deletions tests/test_dropdown_simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,5 +139,6 @@ def test_dropdown_alignment(dropdown_alignment, pdf_samples, request):

expected = f.read()

assert len(obj.read()) == len(expected)
assert obj.stream == expected
if os.name != "nt":
assert len(obj.read()) == len(expected)
assert obj.stream == expected
10 changes: 6 additions & 4 deletions tests/test_functional_simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,9 @@ def test_fill_font_color(sample_template_with_font_colors, pdf_samples, request)

expected = f.read()

assert len(obj.read()) == len(expected)
assert obj.stream == expected
if os.name != "nt":
assert len(obj.read()) == len(expected)
assert obj.stream == expected


def test_fill_complex_fonts(sample_template_with_complex_fonts, pdf_samples, request):
Expand Down Expand Up @@ -109,5 +110,6 @@ def test_fill_complex_fonts(sample_template_with_complex_fonts, pdf_samples, req

expected = f.read()

assert len(obj.read()) == len(expected)
assert obj.stream == expected
if os.name != "nt":
assert len(obj.read()) == len(expected)
assert obj.stream == expected
20 changes: 12 additions & 8 deletions tests/test_paragraph_simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,9 @@ def test_paragraph_auto_font(

expected = f.read()

assert len(obj.read()) == len(expected)
assert obj.stream == expected
if os.name != "nt":
assert len(obj.read()) == len(expected)
assert obj.stream == expected


def test_paragraph_auto_font_auto_wrap(
Expand All @@ -74,8 +75,9 @@ def test_paragraph_auto_font_auto_wrap(

expected = f.read()

assert len(obj.read()) == len(expected)
assert obj.stream == expected
if os.name != "nt":
assert len(obj.read()) == len(expected)
assert obj.stream == expected


def test_paragraph_complex(sample_template_paragraph_complex, pdf_samples, request):
Expand All @@ -97,8 +99,9 @@ def test_paragraph_complex(sample_template_paragraph_complex, pdf_samples, reque

expected = f.read()

assert len(obj.read()) == len(expected)
assert obj.stream == expected
if os.name != "nt":
assert len(obj.read()) == len(expected)
assert obj.stream == expected


def test_paragraph_max_length(
Expand All @@ -117,5 +120,6 @@ def test_paragraph_max_length(

expected = f.read()

assert len(obj.read()) == len(expected)
assert obj.stream == expected
if os.name != "nt":
assert len(obj.read()) == len(expected)
assert obj.stream == expected

0 comments on commit 4435b55

Please sign in to comment.