summaryrefslogtreecommitdiffstats
path: root/tests/test_csl.py
blob: e8ded911d8f6ae046c1b396c662fd37bcdcc57c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
from grobid_tei_xml import parse_document_xml


def test_small_xml_csl() -> None:

    with open("tests/files/small.xml", "r") as f:
        tei_xml = f.read()

    d = parse_document_xml(tei_xml)
    assert d.to_csl_dict() == {
        "type": "article-journal",
        "title": "Dummy Example File",
        "author": [
            {"given": "Brewster", "family": "Kahle"},
            {
                "given": "J",
                "family": "Doe",
            },
        ],
        "book-title": "Dummy Example File. Journal of Fake News. pp. 1-2. ISSN 1234-5678",
        "issued": [[2000]],
    }

    assert d.citations
    assert d.citations[0].to_csl_dict() == {
        "type": "article-journal",
        "title": "Everything is Wonderful",
        "author": [
            {"given": "A", "family": "Seaperson"},
        ],
        "container-title": "Letters in the Alphabet",
        "issued": [[2001]],
        "volume": 20,
        "page": "1-11",
        "page-first": "1",
    }