Skip to content

Commit

Permalink
feat: add accepted flag to worms.get_descendants_names
Browse files Browse the repository at this point in the history
Add support for worms-server 0.5.2
  • Loading branch information
kevinsbarnard committed Apr 9, 2024
1 parent ae391be commit de0aec2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fathomnet/api/worms.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ def get_children_names(name: str) -> List[str]:
return Worms.get(f'children/{name}')


def get_descendants_names(name: str) -> List[str]:
def get_descendants_names(name: str, accepted: bool = False) -> List[str]:
"""Get all descendants' names of a given name."""
return Worms.get(f'descendants/{name}')
return Worms.get(f'descendants/{name}', params={'accepted': accepted})


def get_parent_name(name: str) -> str:
Expand Down
6 changes: 6 additions & 0 deletions test/test_worms.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ def test_get_descendants_names(self):
self.assertIsNotNone(descendants)
self.assertIn('Bathochordaeus charon', descendants)

siph_all_descendants = worms.get_descendants_names('Siphonophorae', accepted=False)
siph_accepted_descendants = worms.get_descendants_names('Siphonophorae', accepted=True)
self.assertIsNotNone(siph_all_descendants)
self.assertIsNotNone(siph_accepted_descendants)
self.assertGreater(len(siph_all_descendants), len(siph_accepted_descendants))

def test_get_parent_name(self):
parent = worms.get_parent_name('Bathochordaeus charon')
self.assertIsNotNone(parent)
Expand Down

0 comments on commit de0aec2

Please sign in to comment.