aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/test_csl.py40
1 files changed, 40 insertions, 0 deletions
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",
+ }