diff options
author | Bryan Newbold <bnewbold@archive.org> | 2021-11-03 19:36:09 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@archive.org> | 2021-11-03 19:36:09 -0700 |
commit | 7439ade08f185eaa6ac44b8ab509a8d3c047d574 (patch) | |
tree | 75b175b435b661655537cf6d50c2c88a56853696 /tests | |
parent | 9c1d72ea9dde74ab594795377e47b9b764adf60f (diff) | |
download | grobid_tei_xml-7439ade08f185eaa6ac44b8ab509a8d3c047d574.tar.gz grobid_tei_xml-7439ade08f185eaa6ac44b8ab509a8d3c047d574.zip |
add failing test for single editor tag, multiple persname
Diffstat (limited to 'tests')
-rw-r--r-- | tests/files/citation/single_editor_multiple_persname.grobid070.tei.xml | 38 | ||||
-rw-r--r-- | tests/test_parse.py | 20 |
2 files changed, 58 insertions, 0 deletions
diff --git a/tests/files/citation/single_editor_multiple_persname.grobid070.tei.xml b/tests/files/citation/single_editor_multiple_persname.grobid070.tei.xml new file mode 100644 index 0000000..8c1aa1b --- /dev/null +++ b/tests/files/citation/single_editor_multiple_persname.grobid070.tei.xml @@ -0,0 +1,38 @@ +<biblStruct > + <analytic> + <title level="a" type="main">Uterine cancer</title> + <author> + <persName> + <forename type="first">J</forename> + <forename type="middle">R</forename> + <surname>Lurain</surname> + </persName> + </author> + </analytic> + <monogr> + <title level="m">Novak’s gynecology</title> + <editor> + <persName> + <forename type="first">J</forename> + <forename type="middle">S</forename> + <surname>Berek</surname> + </persName> + <persName> + <forename type="first">E</forename> + <forename type="middle">Y</forename> + <surname>Adashi</surname> + </persName> + <persName> + <forename type="first">P</forename> + <forename type="middle">A</forename> + <surname>Hillard</surname> + </persName> + </editor> + <imprint> + <publisher>Williams and Wilkins</publisher> + <date type="published" when="1996">1996</date> + <biblScope unit="page" from="1057" to="1110" /> + </imprint> + </monogr> + <note>12th ed. Baltimore</note> +</biblStruct> diff --git a/tests/test_parse.py b/tests/test_parse.py index 5f64a48..832ee78 100644 --- a/tests/test_parse.py +++ b/tests/test_parse.py @@ -386,3 +386,23 @@ def test_citation_list_utf8() -> None: assert ref_str.unstructured == unstructured assert ref_str.first_page == "155" assert ref_str.pages == "155-172" + +def test_citation_multiple_editors() -> None: + with open("tests/files/citation/single_editor_multiple_persname.grobid070.tei.xml", "r") as f: + tei_xml = f.read() + + ref = parse_citation_xml(tei_xml) + assert ref + assert ref.title == "Uterine cancer" + assert len(ref.authors) == 1 + assert ref.authors[0].full_name == "J R Lurain" + assert ref.authors[0].middle_name == "R" + assert ref.authors[0].surname == "Lurain" + assert len(ref.editors) == 3 + assert ref.editors[0].full_name == "J S Berek" + assert ref.editors[1].full_name == "E Y Adashi" + assert ref.editors[2].full_name == "P A Hillard" + assert ref.journal == "Novak’s gynecology" + assert ref.publisher == "Williams and Wilkins" + assert ref.date == "1996" + assert ref.note == "12th ed. Baltimore" |