Skip to content

Commit

Permalink
Revert CladeAnnotation summary to use __str__
Browse files Browse the repository at this point in the history
  • Loading branch information
cmorganl committed Apr 27, 2021
1 parent 5045f77 commit 5956f6a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 6 additions & 0 deletions tests/test_clade_annotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ def test_get_internal_nodes(self):
self.assertEqual([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 185], internal_nodes)
return

def test_summarise(self):
summary = self.test_clade_annot.summarise()
self.assertIsInstance(summary, str)
self.assertTrue(len(summary) > 0)
return


if __name__ == '__main__':
unittest.main()
4 changes: 1 addition & 3 deletions treesapp/clade_annotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ def __init__(self, name: str, key: str):
self.colour = ""

def __str__(self) -> str:
return "CladeAnnotation object '{}' of '{}' annotation with '{}' members.".format(self.name,
self.feature,
len(self.members))
return self.summarise()

def summarise(self) -> str:
summary_str = "Annotation '{}' of feature '{}' status:\n".format(self.name, self.feature)
Expand Down

0 comments on commit 5956f6a

Please sign in to comment.