diff --git a/PyPDFForm/wrapper.py b/PyPDFForm/wrapper.py index a2ed2470..53fb5b02 100644 --- a/PyPDFForm/wrapper.py +++ b/PyPDFForm/wrapper.py @@ -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 + ) diff --git a/tests/test_fill_max_length_text_field.py b/tests/test_fill_max_length_text_field.py index b6e5cb14..7bf19c2f 100644 --- a/tests/test_fill_max_length_text_field.py +++ b/tests/test_fill_max_length_text_field.py @@ -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( { @@ -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( { @@ -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( { @@ -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( { @@ -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( { @@ -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( { @@ -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() @@ -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: diff --git a/tests/test_functional.py b/tests/test_functional.py index 3bac7580..39b4770e 100644 --- a/tests/test_functional.py +++ b/tests/test_functional.py @@ -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"),