aboutsummaryrefslogtreecommitdiffstats
path: root/python/tests
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@archive.org>2021-10-27 19:10:35 -0700
committerBryan Newbold <bnewbold@archive.org>2021-10-27 19:10:35 -0700
commita0e275a4bad46ef41585f0207d6dfa1e3c38bc35 (patch)
tree92dead8a85e6ff38808beefada8a42693261ceff /python/tests
parent40adf5ed09d917b8a4b8f75680bbf90c147848b3 (diff)
downloadsandcrawler-a0e275a4bad46ef41585f0207d6dfa1e3c38bc35.tar.gz
sandcrawler-a0e275a4bad46ef41585f0207d6dfa1e3c38bc35.zip
remove grobid2json helper file, replace with grobid_tei_xml
Diffstat (limited to 'python/tests')
-rw-r--r--python/tests/test_grobid2json.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/python/tests/test_grobid2json.py b/python/tests/test_grobid2json.py
index 98888e8..b00a88d 100644
--- a/python/tests/test_grobid2json.py
+++ b/python/tests/test_grobid2json.py
@@ -2,23 +2,27 @@ import json
import xml
import pytest
-
-from grobid2json import *
+from grobid_tei_xml import parse_document_xml
def test_small_xml():
+ """
+ This used to be a test of grobid2json; now it is a compatability test for
+ the to_legacy_dict() feature of grobid_tei_xml.
+ """
with open("tests/files/small.xml", "r") as f:
tei_xml = f.read()
with open("tests/files/small.json", "r") as f:
json_form = json.loads(f.read())
- assert teixml2json(tei_xml) == json_form
+ tei_doc = parse_document_xml(tei_xml)
+ assert tei_doc.to_legacy_dict() == json_form
def test_invalid_xml():
with pytest.raises(xml.etree.ElementTree.ParseError):
- teixml2json("this is not XML")
+ parse_document_xml("this is not XML")
with pytest.raises(ValueError):
- teixml2json("<xml></xml>")
+ parse_document_xml("<xml></xml>")