Ejemplo n.º 1
0
    def testItersMixingIterations(self):
        root = self.client.parse(__file__).uast
        it = iterator(root, TreeOrder.PRE_ORDER)
        next(it)
        next(it)
        next(it)
        n = next(it)
        it2 = iterator(n, TreeOrder.PRE_ORDER)
        next(it2)
        val_it1 = next(it).get()
        val_it2 = next(it2).get()

        self.assertDictEqual(val_it1, val_it2)
Ejemplo n.º 2
0
 def testIteratorPositionOrder(self):
     root = self._itTestTree()
     it = iterator(root, TreeOrder.POSITION_ORDER)
     self.assertIsNotNone(it)
     expanded = [node.internal_type for node in it]
     self.assertListEqual(expanded, ['root', 'son1', 'son2_1', 'son1_1',
                                     'son1_2', 'son2_2', 'son2'])
Ejemplo n.º 3
0
 def testFilterInsideIter(self):
     root = self._parse_fixture().uast
     it = iterator(root, TreeOrder.PRE_ORDER)
     self.assertIsNotNone(it)
     for n in it:
         xpath_filter(n, "//*[@roleIdentifier]")