def testReset(self): adaptor = CommonTreeAdaptor() wiz = TreeWizard(adaptor, self.tokens) t = wiz.create("(A (B (C D E) F) G)") it = TreeIterator(t) expecting = "A DOWN B DOWN C DOWN D E UP F UP G UP EOF" found = self.toString(it) self.assertEquals(expecting, found) it.reset() expecting = "A DOWN B DOWN C DOWN D E UP F UP G UP EOF" found = self.toString(it) self.assertEquals(expecting, found)
def testReset(self): adaptor = CommonTreeAdaptor() wiz = TreeWizard(adaptor, self.tokens) t = wiz.create("(A (B (C D E) F) G)") it = TreeIterator(t) expecting = "A DOWN B DOWN C DOWN D E UP F UP G UP EOF" found = self.toString(it) self.assertEqual(expecting, found) it.reset() expecting = "A DOWN B DOWN C DOWN D E UP F UP G UP EOF" found = self.toString(it) self.assertEqual(expecting, found)
def testVerticalList(self): adaptor = CommonTreeAdaptor() wiz = TreeWizard(adaptor, self.tokens) t = wiz.create("(A (B C))") it = TreeIterator(t) expecting = "A DOWN B DOWN C UP UP EOF" found = self.toString(it) self.assertEqual(expecting, found)
def testFlatAB(self): adaptor = CommonTreeAdaptor() wiz = TreeWizard(adaptor, self.tokens) t = wiz.create("(nil A B)") it = TreeIterator(t) expecting = "nil DOWN A B UP EOF" found = self.toString(it) self.assertEqual(expecting, found)
def testNode(self): adaptor = CommonTreeAdaptor() wiz = TreeWizard(adaptor, self.tokens) t = wiz.create("A") it = TreeIterator(t) expecting = "A EOF" found = self.toString(it) self.assertEqual(expecting, found)
def testABC(self): adaptor = CommonTreeAdaptor() wiz = TreeWizard(adaptor, self.tokens) t = wiz.create("(A B C)") it = TreeIterator(t) expecting = "A DOWN B C UP EOF" found = self.toString(it) self.assertEquals(expecting, found)