示例#1
0
 def testIterator1(self):
     '''Test sample Iterator class'''
     context = Harness(self)
     it = TALES.Iterator('name', (1, ), context)
     context._assert_('setLocal', 'name', 1)
     assert it.next() and not it.next(), "Single-element iterator"
     context._complete_()
示例#2
0
 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':
         assert it.next(), "Multi-element iterator"
     assert not it.next(), "Multi-element iterator"
     context._complete_()
示例#3
0
 def testIterator0(self):
     '''Test sample Iterator class'''
     context = Harness(self)
     it = TALES.Iterator('name', (), context)
     assert not it.next(), "Empty iterator"
     context._complete_()