comparison genshi/template/tests/eval.py @ 804:cce33406c1cf stable-0.5.x

Ported [1005] to 0.5.x branch.
author cmlenz
date Thu, 05 Mar 2009 10:06:45 +0000
parents c690de5abafd
children a134e21a8f44
comparison
equal deleted inserted replaced
801:9fe8fdca279e 804:cce33406c1cf
579 """) 579 """)
580 data = {} 580 data = {}
581 suite.execute(data) 581 suite.execute(data)
582 self.assertEqual([0, 1, 4], data['x']) 582 self.assertEqual([0, 1, 4], data['x'])
583 583
584 def test_for_in_def(self):
585 suite = Suite("""def loop():
586 for i in range(10):
587 if i == 5:
588 break
589 return i
590 """)
591 data = {}
592 suite.execute(data)
593 assert 'loop' in data
594 self.assertEqual(5, data['loop']())
595
584 def test_if(self): 596 def test_if(self):
585 suite = Suite("""if foo == 42: 597 suite = Suite("""if foo == 42:
586 x = True 598 x = True
587 """) 599 """)
588 data = {'foo': 42} 600 data = {'foo': 42}
Copyright (C) 2012-2017 Edgewall Software