diff --git a/tests/test_clade_annotation.py b/tests/test_clade_annotation.py index c6455cf7..a891e885 100644 --- a/tests/test_clade_annotation.py +++ b/tests/test_clade_annotation.py @@ -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() diff --git a/treesapp/clade_annotation.py b/treesapp/clade_annotation.py index afde1741..60b6326b 100644 --- a/treesapp/clade_annotation.py +++ b/treesapp/clade_annotation.py @@ -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)