def testFindNodeWithStringIndexOnSecondLevelWhereFirstLevelIsIndexed(self): elem = BaseTree.IndexedNode(rules=[BaseTree.IndexedNode]) self.item.AddNode(elem) second = BaseTree.IndexedNode(rules=[BaseTree.Node]) self.item.AddNode(second, "A") third = BaseTree.Node() self.item.AddNode(third, "B") self.assertEqual(self.item.FindNodeByIndex("B"), third)
def testAddNodeWithIndex(self): elem = BaseTree.IndexedNode(rules=[BaseTree.EmptyNode], limit=1) second_elem = BaseTree.EmptyNode(0) self.item.AddNode(elem) self.item.AddNode(second_elem, index=2) self.assertEqual(elem.GetChild(2), second_elem)
def testFindNodeWithStringIndex(self): elem = BaseTree.IndexedNode(rules=[BaseTree.Node]) self.item.AddNode(elem) second = BaseTree.Node() self.item.AddNode(second, "P1") self.assertEqual(self.item.FindNodeByIndex("P1"), second)