4343from .test_images import image_similarity
4444
4545filter_inputs = (
46+ string .ascii_letters ,
4647 string .ascii_lowercase ,
4748 string .ascii_uppercase ,
48- string .ascii_letters ,
4949 string .digits ,
5050 string .hexdigits ,
51+ string .octdigits ,
5152 string .punctuation ,
52- string .whitespace , # Add more...
53+ string .printable ,
54+ string .whitespace , # Add more
5355)
5456
5557TESTS_ROOT = Path (__file__ ).parent .resolve ()
@@ -72,14 +74,12 @@ def test_flatedecode_unsupported_predictor():
7274 """
7375 FlateDecode raises PdfReadError for unsupported predictors.
7476
75- Predictors outside the [ 10, 15] range are not supported.
77+ Predictor values outside the ranges [1, 2] and [ 10, 15] are not supported.
7678
77- This test function checks that a PdfReadError is raised when decoding with
78- unsupported predictors. Once this predictor support is updated in the
79- future, this test case may be removed.
79+ Checks that a PdfReadError is raised when decoding with unsupported predictors.
8080 """
8181 codec = FlateDecode ()
82- predictors = (- 10 , - 1 , 0 , 9 , 16 , 20 , 100 )
82+ predictors = (- 10 , - 1 , 0 , 3 , 9 , 16 , 20 , 100 )
8383
8484 for predictor , s in cartesian_product (predictors , filter_inputs ):
8585 s = s .encode ()
@@ -133,11 +133,10 @@ def test_ascii_hex_decode_method(data, expected):
133133 assert ASCIIHexDecode .decode (data ) == expected
134134
135135
136- def test_ascii_hex_decode_missing_eod ():
137- """ASCIIHexDecode.decode() raises error when no EOD character is present."""
138- # with pytest.raises(PdfStreamError) as exc:
136+ def test_ascii_hex_decode_missing_eod (caplog ):
137+ """ASCIIHexDecode.decode() logs warning when no EOD character is present."""
139138 ASCIIHexDecode .decode ("" )
140- # assert exc.value.args[0] == "Unexpected EOD in ASCIIHexDecode"
139+ assert "missing EOD in ASCIIHexDecode, check if output is OK" in caplog . text
141140
142141
143142@pytest .mark .enable_socket
@@ -239,8 +238,7 @@ def test_ccitt_fax_decode():
239238 {"/K" : NumberObject (- 1 ), "/Columns" : NumberObject (17 )}
240239 )
241240
242- # This was just the result pypdf 1.27.9 returned.
243- # It would be awesome if we could check if that is actually correct.
241+ # This is the header of an empty TIFF image.
244242 assert CCITTFaxDecode .decode (data , parameters ) == (
245243 b"II*\x00 \x08 \x00 \x00 \x00 \x08 \x00 \x00 \x01 \x04 \x00 \x01 \x00 \x00 \x00 \x11 \x00 "
246244 b"\x00 \x00 \x01 \x01 \x04 \x00 \x01 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x02 \x01 "
0 commit comments