Skip to content

Commit

Permalink
Address stefans review - thanks
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinThoma committed Jan 2, 2024
1 parent 9e16b7d commit 83f1ae3
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions tests/test_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import time
from io import BytesIO
from pathlib import Path
from typing import Union
from typing import List, Union

import pytest

Expand Down Expand Up @@ -37,6 +37,9 @@
SAMPLE_ROOT = PROJECT_ROOT / "sample-files"


NestedList = Union[int, None, List["NestedList"]]


@pytest.mark.parametrize(
("src", "num_pages"),
[("selenium-pypdf-issue-177.pdf", 1), ("pdflatex-outline.pdf", 4)],
Expand Down Expand Up @@ -696,15 +699,14 @@ def test_issue604(caplog, strict):
]
assert normalize_warnings(caplog.text) == msg

def get_dest_pages(x) -> Union[int, None]:
def get_dest_pages(x) -> NestedList:
if isinstance(x, list):
r = [get_dest_pages(y) for y in x]
return r
return [get_dest_pages(y) for y in x]
else:
des_page_number = pdf.get_destination_page_number(x)
if des_page_number is None:
return des_page_number
return des_page_number + 1
destination_page_number = pdf.get_destination_page_number(x)
if destination_page_number is None:
return destination_page_number
return destination_page_number + 1

out = []

Expand Down

0 comments on commit 83f1ae3

Please sign in to comment.