예제 #1
0
 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)
예제 #2
0
 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)
예제 #3
0
 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)