Skip to content

Commit c4d9329

Browse files
Merge pull request #213 from chinapandaman/PPF-211
PPF-211: forgot some tests
2 parents e5ec61c + af1d222 commit c4d9329

File tree

4 files changed

+22
-1
lines changed

4 files changed

+22
-1
lines changed

docs/v2/examples.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ can be used out of box.
77

88
The most common tool to create a PDF form is Adobe Acrobat. A tutorial can be found
99
[here](https://helpx.adobe.com/acrobat/using/creating-distributing-pdf-forms.html).
10-
There are other free alternatives like [sejda](https://www.sejda.com/) that support similar functionalities.
10+
There are other free alternatives like [Sejda](https://www.sejda.com/) that support similar functionalities.
1111

1212
NOTE: Sejda is highly recommended as PyPDFForm
1313
provides more stable support to PDF forms prepared using it with a `sejda` mode.
478 KB
Binary file not shown.

tests/functional/test_pdf_operators.py

+16
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,19 @@ def test_addition_operator_3_times(template_stream, pdf_samples, data_dict):
5353
.split(MergeConstants().separator)[0]
5454
in data_dict
5555
)
56+
57+
58+
def test_addition_operator_3_times_sejda(sejda_template, pdf_samples, sejda_data):
59+
with open(os.path.join(pdf_samples, "sample_added_3_copies_sejda.pdf"), "rb+") as f:
60+
result = PyPDFForm()
61+
expected = f.read()
62+
63+
for i in range(3):
64+
result += PyPDFForm(sejda_template, sejda=True).fill(sejda_data)
65+
66+
page_count = len(TemplateCore().get_elements_by_page(expected).keys())
67+
result_page_count = len(
68+
TemplateCore().get_elements_by_page(result.stream).keys()
69+
)
70+
assert page_count == result_page_count
71+
assert result.read() == expected

tests/unit/test_template.py

+5
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,11 @@ def test_validate_template_stream(template_stream):
6969
assert True
7070

7171

72+
def test_remove_all_elements(template_stream):
73+
result = TemplateCore().remove_all_elements(template_stream)
74+
assert not TemplateCore().iterate_elements(result)
75+
76+
7277
def test_iterate_elements_and_get_element_key(
7378
template_with_radiobutton_stream, data_dict
7479
):

0 commit comments

Comments
 (0)