code: def test_node_add_children_drop_children():
      """Test that replacing a children removes the node from previous parent's children"""
      grand_parent = TreeNode("test")
      parent = TreeNode("test", grand_parent)
      child = TreeNode("test", parent)
  
      assert child.parent is parent
      assert child.parent.parent is grand_parent
      assert grand_parent.children[0] is parent
      assert grand_parent.children[0].children[0] is child
  
      # That's silly...
      grand_parent.add_children(child)
  
      assert child.parent is grand_parent
      assert len(grand_parent.children) == 2
      assert grand_parent.parent is None
      assert len(parent.children) == 0
      assert parent.parent is grand_parent
  
imports: from orion.core.utils.tree import DepthFirstTraversal, PreOrderTraversal, TreeNode, flattened
label_desc: Use image node_id 19 for calling a global function with example usage: test_node_add_children_drop_children() without return types