diff options
author | Bryan Newbold <bnewbold@archive.org> | 2021-11-03 20:36:51 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@archive.org> | 2021-11-03 20:36:51 -0700 |
commit | 99b0ab9e0c3b860754f05cc96c350e2608f932ff (patch) | |
tree | 79fcc1800157b64574677424d498af2a19985bc1 /tests | |
parent | 132d257befc2088a98b3fe10aa71713338d15673 (diff) | |
download | grobid_tei_xml-99b0ab9e0c3b860754f05cc96c350e2608f932ff.tar.gz grobid_tei_xml-99b0ab9e0c3b860754f05cc96c350e2608f932ff.zip |
add a test for a proceedings citation; 'meeting' is not implemented yet
Diffstat (limited to 'tests')
-rw-r--r-- | tests/files/citation/citation_proceedings.tei.xml | 36 | ||||
-rw-r--r-- | tests/test_parse.py | 22 |
2 files changed, 58 insertions, 0 deletions
diff --git a/tests/files/citation/citation_proceedings.tei.xml b/tests/files/citation/citation_proceedings.tei.xml new file mode 100644 index 0000000..96dbd13 --- /dev/null +++ b/tests/files/citation/citation_proceedings.tei.xml @@ -0,0 +1,36 @@ +<biblStruct > + <analytic> + <title level="a" type="main">Sim-to-Real Transfer of Robotic Control with Dynamics Randomization</title> + <author> + <persName> + <forename type="first">Marcin</forename> + <surname>Xue Bin Peng</surname> + </persName> + </author> + <author> + <persName> + <forename type="first">Wojciech</forename> + <surname>Andrychowicz</surname> + </persName> + </author> + <author> + <persName> + <forename type="first">Pieter</forename> + <surname>Zaremba</surname> + </persName> + </author> + <author> + <persName> + <surname>Abbeel</surname> + </persName> + </author> + </analytic> + <monogr> + <title level="m">Proceedings - IEEE International Conference on Robotics and Automation</title> + <meeting>IEEE International Conference on Robotics and Automation</meeting> + <imprint> + <date type="published" when="2018">2018. 2018</date> + <biblScope unit="page" from="3803" to="3810" /> + </imprint> + </monogr> +</biblStruct> diff --git a/tests/test_parse.py b/tests/test_parse.py index a818f09..9e903fa 100644 --- a/tests/test_parse.py +++ b/tests/test_parse.py @@ -456,3 +456,25 @@ def test_citation_bare_editor() -> None: assert ref.editors assert len(ref.editors) == 1 assert ref.editors[0].full_name == "Mitchell C" + + +def test_citation_proceedings() -> None: + with open("tests/files/citation/citation_proceedings.tei.xml", "r") as f: + tei_xml = f.read() + + ref = parse_citation_xml(tei_xml) + assert ref + assert ref.title == "Sim-to-Real Transfer of Robotic Control with Dynamics Randomization" + assert ( + ref.book_title + == "Proceedings - IEEE International Conference on Robotics and Automation" + ) + # TODO: ref.meeting: IEEE International Conference on Robotics and Automation + assert ref.publisher is None + # <date type="published" when="2018">2018. 2018</date> + assert ref.pages == "3803-3810" + assert ref.date == "2018" + assert ref.authors + assert ref.authors[0].given_name == "Marcin" + assert ref.authors[3].full_name == "Abbeel" + assert ref.editors is None |