From fa1e2b68fdc8426b0e6239c65361b605eba5fe7b Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Fri, 22 Oct 2021 19:04:16 -0700 Subject: initial CSL conversion test --- tests/test_csl.py | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 tests/test_csl.py (limited to 'tests') diff --git a/tests/test_csl.py b/tests/test_csl.py new file mode 100644 index 0000000..9c8bd5f --- /dev/null +++ b/tests/test_csl.py @@ -0,0 +1,40 @@ +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", + }, + ], + "container-title": "Dummy Example File. Journal of Fake News. pp. 1-2. ISSN 1234-5678", + "issued": [[2000]], + } + + 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", + } -- cgit v1.2.3