Skip to content

Commit

Permalink
Merge pull request #439 from elifesciences/develop
Browse files Browse the repository at this point in the history
PR for version 0.40.0 release
  • Loading branch information
gnott committed Feb 27, 2024
2 parents 735a44e + 936572c commit 89ed20d
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 1 deletion.
2 changes: 1 addition & 1 deletion elifetools/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.39.0"
__version__ = "0.40.0"
5 changes: 5 additions & 0 deletions elifetools/parseJATS.py
Original file line number Diff line number Diff line change
Expand Up @@ -5361,6 +5361,11 @@ def funding_awards_json(soup):
utils.set_if_value(
award_content, "awardId", award_group.get("award-id")
)
# set awardDoi if applicable
if award_group.get("award-id-type") == "doi":
utils.set_if_value(
award_content, "awardDoi", award_group.get("award-id")
)

if len(award_content) > 0:
awards.append(award_content)
Expand Down
22 changes: 22 additions & 0 deletions tests/fixtures/test_funding_awards_json/content_08.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<root xmlns:xlink="http://www.w3.org/1999/xlink">
<front>
<journal-meta>
<journal-id journal-id-type="publisher-id">eLife</journal-id>
</journal-meta>
<article-meta>
<article-id pub-id-type="publisher-id">90959</article-id>
<article-id pub-id-type="doi">10.7554/eLife.90959</article-id>
<funding-group>
<award-group id="fund3">
<funding-source>
<institution-wrap>
<institution-id institution-id-type="FundRef">http://dx.doi.org/10.13039/100010269</institution-id>
<institution>Wellcome Trust</institution>
</institution-wrap>
</funding-source>
<award-id award-id-type="doi">10.35802/212242</award-id>
</award-group>
</funding-group>
</article-meta>
</front>
</root>
18 changes: 18 additions & 0 deletions tests/fixtures/test_funding_awards_json/content_08_expected.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# coding=utf-8
from collections import OrderedDict

expected = [
OrderedDict(
[
("id", "fund3"),
(
"source",
OrderedDict(
[("funderId", "10.13039/100010269"), ("name", ["Wellcome Trust"])]
),
),
("awardId", "10.35802/212242"),
("awardDoi", "10.35802/212242"),
]
)
]
5 changes: 5 additions & 0 deletions tests/test_parse_jats.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,11 @@ def test_funding_awards_json_by_file(self, filename, expected_len):
read_fixture("test_funding_awards_json", "content_07.xml"),
read_fixture("test_funding_awards_json", "content_07_expected.py"),
),
# 90959 v1 example funding award with an award DOI, sans recipients
(
read_fixture("test_funding_awards_json", "content_08.xml"),
read_fixture("test_funding_awards_json", "content_08_expected.py"),
),
)
def test_funding_awards_json(self, xml_content, expected):
soup = parser.parse_xml(xml_content)
Expand Down

0 comments on commit 89ed20d

Please sign in to comment.