def testCountCladesEmptyTree(self): """ In a tree with no children, there are no clades. """ njtree = NJTree() njtree.tree = TreeNode() self.assertEqual(Counter(), njtree.countClades())
def testCountCladesOneChild(self): """ In a tree with one child, there is one clade. """ njtree = NJTree() njtree.tree = TreeNode(children=[ TreeNode(name='a'), ]) self.assertEqual( { frozenset(['a']): 1, }, njtree.countClades() )
def testCountCladesTwoChildren(self): """ In a tree with two children, one of which has two children, there are two clades. """ njtree = NJTree() njtree.tree = TreeNode(children=[ TreeNode(children=[ TreeNode(name='a'), TreeNode(name='b'), ]), TreeNode(name='c'), ]) self.assertEqual( { frozenset(['a', 'b']): 1, frozenset(['a', 'b', 'c']): 1, }, njtree.countClades() )