aboutsummaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2019-12-23 14:00:59 -0800
committerBryan Newbold <bnewbold@robocracy.org>2019-12-23 14:00:59 -0800
commit4c2ca53303a949c00707e0c552489930f059a54a (patch)
treed3d59050e48efef6be5903f8e299d64743fc8c7b /python
parent052907bf8af22a2638554b719410b10ac1a8f9b6 (diff)
downloadfatcat-4c2ca53303a949c00707e0c552489930f059a54a.tar.gz
fatcat-4c2ca53303a949c00707e0c552489930f059a54a.zip
add regression test for medlinedate -> year parsing
Diffstat (limited to 'python')
-rw-r--r--python/tests/files/pubmed_31393839.xml95
-rw-r--r--python/tests/import_pubmed.py7
2 files changed, 102 insertions, 0 deletions
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 @@
+<PubmedArticle>
+ <MedlineCitation Status="MEDLINE" IndexingMethod="Automated" Owner="NLM">
+ <PMID Version="1">31393839</PMID>
+ <DateCompleted>
+ <Year>2019</Year>
+ <Month>12</Month>
+ <Day>17</Day>
+ </DateCompleted>
+ <DateRevised>
+ <Year>2019</Year>
+ <Month>12</Month>
+ <Day>17</Day>
+ </DateRevised>
+ <Article PubModel="Print">
+ <Journal>
+ <ISSN IssnType="Print">0022-3875</ISSN>
+ <JournalIssue CitedMedium="Print">
+ <Volume>53</Volume>
+ <Issue>6</Issue>
+ <PubDate>
+ <MedlineDate>2019</MedlineDate>
+ </PubDate>
+ </JournalIssue>
+ <Title>Journal of clinical orthodontics : JCO</Title>
+ <ISOAbbreviation>J Clin Orthod</ISOAbbreviation>
+ </Journal>
+ <ArticleTitle>Career-Turning Moments.</ArticleTitle>
+ <Pagination>
+ <MedlinePgn>325</MedlinePgn>
+ </Pagination>
+ <AuthorList CompleteYN="Y">
+ <Author ValidYN="Y">
+ <LastName>Keim</LastName>
+ <ForeName>Robert G</ForeName>
+ <Initials>RG</Initials>
+ <AffiliationInfo>
+ <Affiliation>J Clin Orthod, Greenwood Village, CO.</Affiliation>
+ </AffiliationInfo>
+ </Author>
+ </AuthorList>
+ <Language>eng</Language>
+ <PublicationTypeList>
+ <PublicationType UI="D016428">Journal Article</PublicationType>
+ </PublicationTypeList>
+ </Article>
+ <MedlineJournalInfo>
+ <Country>United States</Country>
+ <MedlineTA>J Clin Orthod</MedlineTA>
+ <NlmUniqueID>0243471</NlmUniqueID>
+ <ISSNLinking>0022-3875</ISSNLinking>
+ </MedlineJournalInfo>
+ <CitationSubset>D</CitationSubset>
+ <MeshHeadingList>
+ <MeshHeading>
+ <DescriptorName UI="D001696" MajorTopicYN="N">Biomechanical Phenomena</DescriptorName>
+ </MeshHeading>
+ <MeshHeading>
+ <DescriptorName UI="D002321" MajorTopicYN="Y">Career Choice</DescriptorName>
+ </MeshHeading>
+ <MeshHeading>
+ <DescriptorName UI="D006801" MajorTopicYN="N">Humans</DescriptorName>
+ </MeshHeading>
+ </MeshHeadingList>
+ </MedlineCitation>
+ <PubmedData>
+ <History>
+ <PubMedPubDate PubStatus="entrez">
+ <Year>2019</Year>
+ <Month>8</Month>
+ <Day>9</Day>
+ <Hour>6</Hour>
+ <Minute>0</Minute>
+ </PubMedPubDate>
+ <PubMedPubDate PubStatus="pubmed">
+ <Year>2019</Year>
+ <Month>8</Month>
+ <Day>9</Day>
+ <Hour>6</Hour>
+ <Minute>0</Minute>
+ </PubMedPubDate>
+ <PubMedPubDate PubStatus="medline">
+ <Year>2019</Year>
+ <Month>12</Month>
+ <Day>18</Day>
+ <Hour>6</Hour>
+ <Minute>0</Minute>
+ </PubMedPubDate>
+ </History>
+ <PublicationStatus>ppublish</PublicationStatus>
+ <ArticleIdList>
+ <ArticleId IdType="pubmed">31393839</ArticleId>
+ </ArticleIdList>
+ </PubmedData>
+</PubmedArticle>
+
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
+