Skip to content

Commit

Permalink
[skip ci]: black/isort
Browse files Browse the repository at this point in the history
  • Loading branch information
black-isort-bot committed Jan 18, 2023
1 parent 74269b1 commit b1e0305
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 13 deletions.
4 changes: 3 additions & 1 deletion PyPDFForm/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,4 +175,6 @@ def register_font(

ttf_file = adapter.fp_or_f_obj_or_stream_to_stream(ttf_file)

return font.register_font(font_name, ttf_file) if ttf_file is not None else False
return (
font.register_font(font_name, ttf_file) if ttf_file is not None else False
)
31 changes: 23 additions & 8 deletions tests/test_fill_max_length_text_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ def test_fill_max_length_text_field_all_chars(
sample_template_with_max_length_text_field, max_length_expected_directory
):
with open(
os.path.join(max_length_expected_directory, "max_length_text_field_all_chars.pdf"), "rb+"
os.path.join(
max_length_expected_directory, "max_length_text_field_all_chars.pdf"
),
"rb+",
) as f:
obj = PyPDFForm(sample_template_with_max_length_text_field).fill(
{
Expand All @@ -31,7 +34,10 @@ def test_fill_max_length_text_field_odd_chars(
sample_template_with_max_length_text_field, max_length_expected_directory
):
with open(
os.path.join(max_length_expected_directory, "max_length_text_field_odd_chars.pdf"), "rb+"
os.path.join(
max_length_expected_directory, "max_length_text_field_odd_chars.pdf"
),
"rb+",
) as f:
obj = PyPDFForm(sample_template_with_max_length_text_field).fill(
{
Expand All @@ -53,7 +59,10 @@ def test_fill_max_length_text_field_even_chars(
sample_template_with_max_length_text_field, max_length_expected_directory
):
with open(
os.path.join(max_length_expected_directory, "max_length_text_field_even_chars.pdf"), "rb+"
os.path.join(
max_length_expected_directory, "max_length_text_field_even_chars.pdf"
),
"rb+",
) as f:
obj = PyPDFForm(sample_template_with_max_length_text_field).fill(
{
Expand All @@ -75,7 +84,8 @@ def test_fill_comb_text_field_all_chars(
sample_template_with_comb_text_field, max_length_expected_directory
):
with open(
os.path.join(max_length_expected_directory, "comb_text_field_all_chars.pdf"), "rb+"
os.path.join(max_length_expected_directory, "comb_text_field_all_chars.pdf"),
"rb+",
) as f:
obj = PyPDFForm(sample_template_with_comb_text_field).fill(
{
Expand All @@ -97,7 +107,8 @@ def test_fill_comb_text_field_odd_chars(
sample_template_with_comb_text_field, max_length_expected_directory
):
with open(
os.path.join(max_length_expected_directory, "comb_text_field_odd_chars.pdf"), "rb+"
os.path.join(max_length_expected_directory, "comb_text_field_odd_chars.pdf"),
"rb+",
) as f:
obj = PyPDFForm(sample_template_with_comb_text_field).fill(
{
Expand All @@ -119,7 +130,8 @@ def test_fill_comb_text_field_even_chars(
sample_template_with_comb_text_field, max_length_expected_directory
):
with open(
os.path.join(max_length_expected_directory, "comb_text_field_even_chars.pdf"), "rb+"
os.path.join(max_length_expected_directory, "comb_text_field_even_chars.pdf"),
"rb+",
) as f:
obj = PyPDFForm(sample_template_with_comb_text_field).fill(
{
Expand All @@ -140,7 +152,9 @@ def test_fill_comb_text_field_even_chars(
def test_fill_comb_text_field_void(
sample_template_with_comb_text_field, max_length_expected_directory
):
with open(os.path.join(max_length_expected_directory, "comb_text_field_void.pdf"), "rb+") as f:
with open(
os.path.join(max_length_expected_directory, "comb_text_field_void.pdf"), "rb+"
) as f:
obj = PyPDFForm(sample_template_with_comb_text_field).fill({})

expected = f.read()
Expand All @@ -154,7 +168,8 @@ def test_fill_comb_text_field_even_chars_right_aligned(
):
with open(
os.path.join(
max_length_expected_directory, "comb_text_field_even_chars_right_aligned.pdf"
max_length_expected_directory,
"comb_text_field_even_chars_right_aligned.pdf",
),
"rb+",
) as f:
Expand Down
5 changes: 1 addition & 4 deletions tests/test_functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,7 @@ def test_fill_font_liberation_serif_italic(
with open(os.path.join(font_samples, "LiberationSerif-Italic.ttf"), "rb+") as _f:
stream = _f.read()
_f.seek(0)
PyPDFForm.register_font(
"LiberationSerif-Italic",
stream
)
PyPDFForm.register_font("LiberationSerif-Italic", stream)

with open(
os.path.join(pdf_samples, "sample_filled_font_liberation_serif_italic.pdf"),
Expand Down

0 comments on commit b1e0305

Please sign in to comment.