Skip to content

Commit 814017e

Browse files
Merge pull request #260 from chinapandaman/PPF-259
PPF-259: add how to contribute
2 parents 9f7cb66 + 2af7ee4 commit 814017e

8 files changed

+15
-54
lines changed

PyPDFForm/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@
77
PyPDFForm = Wrapper
88
PyPDFForm2 = WrapperV2
99

10-
__version__ = "1.0.2"
10+
__version__ = "1.0.3"

README.md

+10
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,13 @@ functionalities.
6868

6969
It is strongly advised that you use PyPDFForm2 since only minimum supports will be made to PyPDFForm
7070
from now on.
71+
72+
## How to Contribute
73+
74+
If you wish to improve this library, there is one specific way you can contribute
75+
on top of the usual open source project norms such as issues and pull requests.
76+
77+
It is difficult to make sure that the library supports all the PDF form creating tools out
78+
there. So if you run into a case where the library does not work for certain PDF forms created by
79+
certain tools, feel free to open an issue with the problematic PDF form attached. I will seek
80+
to make the library support the attached PDF form as well as the tool used to create it.
-48 KB
Binary file not shown.
-712 KB
Binary file not shown.
-671 KB
Binary file not shown.

tests/functional/test_draw_on_pdf.py

-28
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,6 @@ def test_draw_image_on_one_page(template_stream, image_stream, pdf_samples):
107107
if os.name == "nt":
108108
assert len(obj.stream) == len(expected)
109109
assert obj.stream == expected
110-
else:
111-
with open(
112-
os.path.join(pdf_samples, "sample_pdf_with_image_linux.pdf"), "rb+"
113-
) as f_linux:
114-
expected = f_linux.read()
115-
assert len(obj.stream) == len(expected)
116-
assert obj.stream == expected
117110

118111

119112
def test_draw_image_on_one_page_fp_param(template_stream, image_samples, pdf_samples):
@@ -127,13 +120,6 @@ def test_draw_image_on_one_page_fp_param(template_stream, image_samples, pdf_sam
127120
if os.name == "nt":
128121
assert len(obj.stream) == len(expected)
129122
assert obj.stream == expected
130-
else:
131-
with open(
132-
os.path.join(pdf_samples, "sample_pdf_with_image_linux.pdf"), "rb+"
133-
) as f_linux:
134-
expected = f_linux.read()
135-
assert len(obj.stream) == len(expected)
136-
assert obj.stream == expected
137123

138124

139125
def test_draw_image_on_one_page_f_obj_param(
@@ -148,13 +134,6 @@ def test_draw_image_on_one_page_f_obj_param(
148134
if os.name == "nt":
149135
assert len(obj.stream) == len(expected)
150136
assert obj.stream == expected
151-
else:
152-
with open(
153-
os.path.join(pdf_samples, "sample_pdf_with_image_linux.pdf"), "rb+"
154-
) as f_linux:
155-
expected = f_linux.read()
156-
assert len(obj.stream) == len(expected)
157-
assert obj.stream == expected
158137

159138

160139
def test_draw_png_image_on_one_page(template_stream, image_samples, pdf_samples):
@@ -173,10 +152,3 @@ def test_draw_png_image_on_one_page(template_stream, image_samples, pdf_samples)
173152
if os.name == "nt":
174153
assert len(obj.stream) == len(expected)
175154
assert obj.stream == expected
176-
else:
177-
with open(
178-
os.path.join(pdf_samples, "sample_pdf_with_png_image_linux.pdf"), "rb+"
179-
) as f_linux:
180-
expected = f_linux.read()
181-
assert len(obj.stream) == len(expected)
182-
assert obj.stream == expected

tests/functional/test_v2.py

-14
Original file line numberDiff line numberDiff line change
@@ -389,13 +389,6 @@ def test_draw_image_on_one_page_v2(template_stream, image_samples, pdf_samples):
389389
if os.name == "nt":
390390
assert len(obj.stream) == len(expected)
391391
assert obj.stream == expected
392-
else:
393-
with open(
394-
os.path.join(pdf_samples, "sample_pdf_with_image_linux.pdf"), "rb+"
395-
) as f_linux:
396-
expected = f_linux.read()
397-
assert len(obj.stream) == len(expected)
398-
assert obj.stream == expected
399392

400393

401394
def test_draw_png_image_on_one_page_v2(template_stream, image_samples, pdf_samples):
@@ -414,13 +407,6 @@ def test_draw_png_image_on_one_page_v2(template_stream, image_samples, pdf_sampl
414407
if os.name == "nt":
415408
assert len(obj.stream) == len(expected)
416409
assert obj.stream == expected
417-
else:
418-
with open(
419-
os.path.join(pdf_samples, "sample_pdf_with_png_image_linux.pdf"), "rb+"
420-
) as f_linux:
421-
expected = f_linux.read()
422-
assert len(obj.stream) == len(expected)
423-
assert obj.stream == expected
424410

425411

426412
def test_addition_operator_3_times_v2(template_stream, pdf_samples, data_dict):

tests/unit/test_image.py

+4-11
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,6 @@ def after_converted(image_samples):
3737
return f.read()
3838

3939

40-
@pytest.fixture
41-
def after_converted_linux(image_samples):
42-
with open(os.path.join(image_samples, "after_converted_linux.jpg"), "rb+") as f:
43-
return f.read()
44-
45-
4640
def test_is_image(image_stream):
4741
assert not ImageCore().is_image(b"bad_stream")
4842
assert ImageCore().is_image(image_stream)
@@ -67,9 +61,8 @@ def test_rotate_image(image_stream):
6761
rotated_buff.close()
6862

6963

70-
def test_any_image_to_jpg(before_converted, after_converted, after_converted_linux):
64+
def test_any_image_to_jpg(before_converted, after_converted):
7165
_converted = ImageCore().any_image_to_jpg(before_converted)
72-
assert len(_converted) == (
73-
len(after_converted) if os.name == "nt" else len(after_converted_linux)
74-
)
75-
assert _converted == (after_converted if os.name == "nt" else after_converted_linux)
66+
if os.name == "nt":
67+
assert len(_converted) == len(after_converted)
68+
assert _converted == after_converted

0 commit comments

Comments
 (0)