Closed tiagocoutinho closed 4 years ago
>>> t = treelib.Tree() >>> t.create_node('bla', 'r0') >>> print(len(t)) 1 >>> print(t.root) r0 >>> t.remove_node('r0') >>> print(len(t)) 0 >>> print(t.root) None >>> t.create_node('ble', 'r1') >>> print(len(t)) 1 >>> print(t.root) r1
>>> t = treelib.Tree() >>> t.create_node('bla', 'r0') >>> print(len(t)) 1 >>> print(t.root) r0 >>> t.remove_node('r0') >>> print(len(t)) 0 >>> print(t.root) # expected None here r0 >>> t.create_node('ble', 'r1') Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/coutinho/workspace/treelib/treelib/tree.py", line 309, in create_node self.add_node(node, parent) File "/home/coutinho/workspace/treelib/treelib/tree.py", line 270, in add_node raise MultipleRootError("A tree takes one root merely.") treelib.exceptions.MultipleRootError: A tree takes one root merely.
fixed in #128 for 1.6.0 release
expected behaviour
actual behaviour