def testIterator1(self): # Test sample Iterator class context = Harness(self) it = tales.Iterator('name', (1, ), context) context._assert_('setLocal', 'name', 1) self.assert_(it.next() and not it.next(), "Single-element iterator") context._complete_()
def testIterator2(self): # Test sample Iterator class context = Harness(self) it = tales.Iterator('text', 'text', context) for c in 'text': context._assert_('setLocal', 'text', c) for c in 'text': self.assert_(it.next(), "Multi-element iterator") self.assert_(not it.next(), "Multi-element iterator") context._complete_()
def testIterator0(self): # Test sample Iterator class context = Harness(self) it = tales.Iterator('name', (), context) self.assert_(not it.next(), "Empty iterator") context._complete_()