def testRootByOneNodeName(self): """ Rooting by one node name must work. """ njtree = NJTree() njtree.tree = TreeNode(children=[ TreeNode(name='c'), TreeNode(name='d'), TreeNode(name='b'), TreeNode(name='a')]) self.assertEqual( ['c', 'd', 'b', 'a'], [child.name for child in njtree.root(['a']).tree.children])
def testRootByTwoTreeNodes(self): """ Rooting by two TreeNodes must work. """ njtree = NJTree() njtree.tree = TreeNode(children=[ TreeNode(name='c'), TreeNode(name='d'), TreeNode(name='b'), TreeNode(name='a')]) node1 = njtree.tree.find('a') node2 = njtree.tree.find('b') self.assertEqual( ['c', 'd', 'b', 'a'], [child.name for child in njtree.root([node1, node2]).tree.children])