Example #1
0
 def _createComplexTree(self):
     """
 Creates the following tree
   0: NAME1->NAME3
   1: NAME1->NAME2->NAME4
 """
     self.tree2 = self._AddChild(NAME2, position=1)
     self.tree3 = self._AddChild(NAME3, position=0)
     self.tree4 = PositionTree(NAME4)
     self.tree2.addChild(self.tree4)
Example #2
0
 def testMoveChildToPosition(self):
     if IGNORE_TEST:
         return
     tree5 = PositionTree(NAME5)
     self.root.addChild(tree5)
     new_position = 0
     self.root.moveChildToPosition(self.tree2, new_position)
     self.assertEqual(self.root._children[0], self.tree2)
     # Make sure it works if nothing is moved
     new_position = 0
     self.root.moveChildToPosition(self.tree2, new_position)
     self.assertEqual(self.root._children[0], self.tree2)
     # Move an end tree
     new_position = 0
     self.root.moveChildToPosition(tree5, new_position)
     self.assertEqual(self.root._children[0], tree5)
Example #3
0
 def _AddChild(self, name, position=None):
     new_tree = PositionTree(name)
     self.root.addChild(new_tree, position=position)
     return new_tree
Example #4
0
 def setUp(self):
     self.root = PositionTree(NAME)
     self._createComplexTree()