From 4c2ca53303a949c00707e0c552489930f059a54a Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Mon, 23 Dec 2019 14:00:59 -0800 Subject: add regression test for medlinedate -> year parsing --- python/tests/files/pubmed_31393839.xml | 95 ++++++++++++++++++++++++++++++++++ python/tests/import_pubmed.py | 7 +++ 2 files changed, 102 insertions(+) create mode 100644 python/tests/files/pubmed_31393839.xml (limited to 'python') diff --git a/python/tests/files/pubmed_31393839.xml b/python/tests/files/pubmed_31393839.xml new file mode 100644 index 00000000..644a02ec --- /dev/null +++ b/python/tests/files/pubmed_31393839.xml @@ -0,0 +1,95 @@ + + + 31393839 + + 2019 + 12 + 17 + + + 2019 + 12 + 17 + +
+ + 0022-3875 + + 53 + 6 + + 2019 + + + Journal of clinical orthodontics : JCO + J Clin Orthod + + Career-Turning Moments. + + 325 + + + + Keim + Robert G + RG + + J Clin Orthod, Greenwood Village, CO. + + + + eng + + Journal Article + +
+ + United States + J Clin Orthod + 0243471 + 0022-3875 + + D + + + Biomechanical Phenomena + + + Career Choice + + + Humans + + +
+ + + + 2019 + 8 + 9 + 6 + 0 + + + 2019 + 8 + 9 + 6 + 0 + + + 2019 + 12 + 18 + 6 + 0 + + + ppublish + + 31393839 + + +
+ diff --git a/python/tests/import_pubmed.py b/python/tests/import_pubmed.py index 0d551d02..49609f75 100644 --- a/python/tests/import_pubmed.py +++ b/python/tests/import_pubmed.py @@ -119,3 +119,10 @@ def test_pubmed_xml_parse(pubmed_importer): assert r2.refs[0].extra['unstructured'] == "Microbiology. 2009 Jun;155(Pt 6):1840-6" assert r2.refs[0].extra['pmid'] == "19383690" +def test_pubmed_xml_dates(pubmed_importer): + with open('tests/files/pubmed_31393839.xml', 'r') as f: + soup = BeautifulSoup(f, "xml") + r1 = pubmed_importer.parse_record(soup.find_all("PubmedArticle")[0]) + + assert r1.release_year == 2019 + -- cgit v1.2.3