Skip to content

Commit

Permalink
Flatten authority lists to one level max
Browse files Browse the repository at this point in the history
  • Loading branch information
rafelafrance committed Oct 10, 2024
1 parent 85a721f commit b5ac09c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
4 changes: 3 additions & 1 deletion flora/pylib/rules/taxon.py
Original file line number Diff line number Diff line change
Expand Up @@ -803,7 +803,9 @@ def taxon_extend_match(cls, ent):
if token._.flag == "taxon_data":
taxon.append(token._.trait.taxon)
if token._.trait.authority:
auth.append(token._.trait.authority)
temp = token._.trait.authority
temp = " ".join(temp) if isinstance(temp, list) else temp
auth.append(temp)

elif token._.flag == "taxon" or token.text in "().":
pass
Expand Down
17 changes: 17 additions & 0 deletions tests/rules/test_taxon.py
Original file line number Diff line number Diff line change
Expand Up @@ -594,3 +594,20 @@ def test_taxon_37(self):
),
],
)

# def test_taxon_38(self):
# self.assertEqual(
# parse("""
# Lupinus arizonicus Douglas ex Hooker
# ssp. gracilis (C. P. Smith) Conrad
# var. varia (S. Watson) Conrad"""),
# [
# Taxon(
# taxon="Neptunia gracilis",
# rank="variety",
# start=0,
# end=35,
# authority="Douglas and Hooker",
# ),
# ],
# )

0 comments on commit b5ac09c

Please sign in to comment.