def testUnflattenTwoTrees(self): if IGNORE_TEST: return self.subparent.setIsAttached(False) elements = self.root.flatten() new_tree = NamedTree.unflatten(elements) self.assertTrue(self.root.isEquivalent(new_tree, is_exception=True))
def testUnflattenManyTrees(self): if IGNORE_TEST: return tree = NamedTree.createRandomNamedTree(100, 0.5, prob_detach=0.2) tree._checkTreeStructure() tree_list = tree.flatten() new_tree = NamedTree.unflatten(tree_list) self.assertTrue(tree.isEquivalent(new_tree))
def testUnflattenOneTree(self): if IGNORE_TEST: return tree_list = self.root.flatten() new_tree = NamedTree.unflatten(tree_list) self.assertTrue(self.root.isEquivalent(new_tree))