Skip to content

Commit c93d282

Browse files
authored
STY: Add form feed to WHITESPACES (#3054)
Table 1—White-space characters; ISO 32000-2:2020 (PDF 2.0).
1 parent c87f75f commit c93d282

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

pypdf/_utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ def _get_max_pdf_version_header(header1: str, header2: str) -> str:
124124
return versions[max(pdf_header_indices)]
125125

126126

127-
WHITESPACES = (b" ", b"\n", b"\r", b"\t", b"\x00")
127+
WHITESPACES = (b"\x00", b"\t", b"\n", b"\f", b"\r", b" ")
128128
WHITESPACES_AS_BYTES = b"".join(WHITESPACES)
129129
WHITESPACES_AS_REGEXP = b"[" + WHITESPACES_AS_BYTES + b"]"
130130

tests/test_utils.py

+2
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
(io.BytesIO(b" "), True),
4444
(io.BytesIO(b" \n"), True),
4545
(io.BytesIO(b" \n"), True),
46+
(io.BytesIO(b"\f"), True),
4647
],
4748
)
4849
def test_skip_over_whitespace(stream, expected):
@@ -60,6 +61,7 @@ def test_skip_over_whitespace(stream, expected):
6061
(b" ", True),
6162
(b" \n", True),
6263
(b" \n", True),
64+
(b"\f", True),
6365
],
6466
)
6567
def test_check_if_whitespace_only(value, expected):

0 commit comments

Comments
 (0)