Skip to content

Commit 6152893

Browse files
authored
TST: Fix download issues from #2562 (#2578)
Fix some issues when getting file from remote server.
1 parent bc29901 commit 6152893

File tree

1 file changed

+40
-6
lines changed

1 file changed

+40
-6
lines changed

tests/test_page_labels.py

+40-6
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,27 @@ def test_index2label(caplog):
114114

115115
@pytest.mark.enable_socket()
116116
def test_index2label_kids():
117-
url = "https://www.bk.admin.ch/dam/bk/de/dokumente/terminologie/publikation_25_jahre_rtd.pdf.download.pdf/Terminologie_Epochen,%20Schwerpunkte,%20Umsetzungen.pdf" # noqa: E501
117+
url = "https://github.com/py-pdf/pypdf/files/14858124/Terminologie_Epochen.Schwerpunkte.Umsetzungen.pdf"
118118
r = PdfReader(BytesIO(get_data_from_url(url=url, name="index2label_kids.pdf")))
119119
expected = [
120120
"C1",
121-
"I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX", "X",
122-
"XI", "XII", "XIII", "XIV", "XV", "XVI", "XVII",
121+
"I",
122+
"II",
123+
"III",
124+
"IV",
125+
"V",
126+
"VI",
127+
"VII",
128+
"VIII",
129+
"IX",
130+
"X",
131+
"XI",
132+
"XII",
133+
"XIII",
134+
"XIV",
135+
"XV",
136+
"XVI",
137+
"XVII",
123138
] + list(map(str, range(1, 284)))
124139
for x in ["20", "44", "58", "82", "94", "116", "154", "166", "192", "224", "250"]:
125140
# Some page labels are unused. Removing them is still easier than copying the
@@ -131,10 +146,29 @@ def test_index2label_kids():
131146
@pytest.mark.enable_socket()
132147
def test_index2label_kids__recursive(caplog):
133148
url = "https://github.com/py-pdf/pypdf/files/14842446/tt1.pdf"
134-
r = PdfReader(BytesIO(get_data_from_url(url=url, name="index2label_kids_recursive.pdf")))
149+
r = PdfReader(
150+
BytesIO(get_data_from_url(url=url, name="index2label_kids_recursive.pdf"))
151+
)
135152
expected = [
136-
"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L",
137-
"M", "N", "O", "P", "17", "18", "19"
153+
"A",
154+
"B",
155+
"C",
156+
"D",
157+
"E",
158+
"F",
159+
"G",
160+
"H",
161+
"I",
162+
"J",
163+
"K",
164+
"L",
165+
"M",
166+
"N",
167+
"O",
168+
"P",
169+
"17",
170+
"18",
171+
"19",
138172
]
139173
assert r.page_labels == expected
140174
assert caplog.text != ""

0 commit comments

Comments
 (0)