Пример #1
0
 def testRepeatsIndex(self):
     wiz = TreeWizard(self.adaptor, self.tokens)
     tree = wiz.create("(A B (A C B) B D D)")
     indexMap = wiz.index(tree)
     found = self.__simplifyIndexMap(indexMap)
     expecting = { 8: ['D', 'D'], 6: ['B', 'B', 'B'], 7: ['C'], 5: ['A', 'A'] }
     self.failUnlessEqual(expecting, found)
Пример #2
0
 def testNoRepeatsIndex(self):
     wiz = TreeWizard(self.adaptor, self.tokens)
     tree = wiz.create("(A B C D)")
     indexMap = wiz.index(tree)
     found = self.__simplifyIndexMap(indexMap)
     expecting = { 8:['D'], 6:['B'], 7:['C'], 5:['A'] }
     self.assertEqual(expecting, found)
Пример #3
0
 def testSingleNodeIndex(self):
     wiz = TreeWizard(self.adaptor, self.tokens)
     tree = wiz.create("ID")
     indexMap = wiz.index(tree)
     found = self.__simplifyIndexMap(indexMap)
     expecting = { 10: ["ID"] }
     self.failUnlessEqual(expecting, found)
Пример #4
0
 def testNoRepeatsIndex(self):
     wiz = TreeWizard(self.adaptor, self.tokens)
     tree = wiz.create("(A B C D)")
     indexMap = wiz.index(tree)
     found = self.__simplifyIndexMap(indexMap)
     expecting = {8: ['D'], 6: ['B'], 7: ['C'], 5: ['A']}
     self.assertEqual(expecting, found)