Skip to content

Commit

Permalink
Merge pull request #40 from Luke-Poeppel/37_remove_child_bugfix
Browse files Browse the repository at this point in the history
Fixes #37. Bugfix for `remove_child` (Credit: Ricardo Reis)
  • Loading branch information
Luke-Poeppel committed Sep 20, 2021
2 parents e912f90 + b9a108b commit e254c35
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions treeplotter/tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,13 @@ def add_path_of_children(self, path, final_node_name):
return

def remove_child(self, child_node):
if child_node.item.value not in self.children:
if child_node not in self.children:
raise NodeException("This parent does not have that child.")
self.children.remove(child_node.item.value)
self.children.remove(child_node)
return

def remove_children(self, children_nodes):
for this_child in children_nodes:
for this_child in tuple(children_nodes):
try:
self.remove_child(this_child)
except KeyError:
Expand Down

0 comments on commit e254c35

Please sign in to comment.