aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_djvu_parse.py
blob: f661f33f28d30cc61c916279130dd66d81212d8c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import io
from fatcat_scholar.djvu import djvu_extract_leaf_texts


def test_djvu_extract_leaf_texts() -> None:

    # https://archive.org/details/ERIC_ED441501
    with open("tests/files/ERIC_ED441501_djvu.xml") as f:
        blob = f.read()

    leaves = djvu_extract_leaf_texts(io.StringIO(blob), [3, 6])
    assert 3 in leaves
    assert 6 in leaves
    assert "2. Original cataloging tools" in leaves[3]
    assert len(leaves) == 2