Skip to content

Commit

Permalink
Merge pull request #188 from elifesciences/develop
Browse files Browse the repository at this point in the history
PR for version 0.78.0 release
  • Loading branch information
gnott authored Feb 20, 2025
2 parents b997fac + 0788187 commit 1dbf67b
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 2 deletions.
2 changes: 1 addition & 1 deletion elifecleaner/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import logging


__version__ = "0.77.0"
__version__ = "0.78.0"


LOGGER = logging.getLogger(__name__)
Expand Down
7 changes: 6 additions & 1 deletion elifecleaner/transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,12 @@ def transform_xml_funding(root, zip_file_name):
)
# look for Wellcome term
wellcome = bool(
[funding for funding in funding_sources if "wellcome" in funding.lower()]
[
funding
for funding in funding_sources
if "wellcome" in funding.lower()
and "burroughs wellcome fund" not in funding.lower()
]
)

add_funding_statement = False
Expand Down
29 changes: 29 additions & 0 deletions tests/test_transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -852,6 +852,35 @@ def test_transform_xml_funding_tag_missing(self):
in transform.xml_element_to_string(root_output)
)

def test_edge_case(self):
"test edge case to not match Wellcome funding statement"

# populate an ElementTree
xml_string_start = self.xml_string_start.replace(
(
'<funding-source id="http://dx.doi.org/10.13039/100010269">'
"Wellcome Trust (WT)"
"</funding-source>"
),
(
'<funding-source id="http://dx.doi.org/10.13039/100000861">'
"Burroughs Wellcome Fund"
"</funding-source>"
),
)
xml_string = "%s%s" % (
xml_string_start,
self.xml_string_end,
)
root = ElementTree.fromstring(xml_string)
# invoke the function
root_output = transform.transform_xml_funding(root, "test.zip")
# confirm XML root returned is modified
self.assertTrue(
"<funding-statement>%s</funding-statement>" % WELLCOME_FUNDING_STATEMENT
not in transform.xml_element_to_string(root_output)
)


class TestTransformAssetFileNameMap(unittest.TestCase):
def test_transform_asset_file_name_map_empty(self):
Expand Down

0 comments on commit 1dbf67b

Please sign in to comment.