Example #1
0
File: tests.py Project: wokli/yatte
 def test_each_node_inside_if(self):
     tmpl = t('{% if var < 5 %}{% each q %}{{_}}{%end%}{%end%}')
     self.assertEquals(
         tmpl.render({'var': 3, 'q': range(3)}),
         '012'
     )
     self.assertEqual(
         tmpl.render({'var': 9, 'q': range(3)}),
         ''
     )
Example #2
0
File: tests.py Project: wokli/yatte
 def test_if_node_inside_each(self):
     tmpl = t('{% each var %}{% if _ < t %}{{_}}{%end%}{%end%}')
     self.assertEquals(
         tmpl.render({'t': 3, 'var': range(5)}),
         '012'
     )
     self.assertEquals(
         tmpl.render({'t': 0, 'var': range(5)}),
         ''
     )
Example #3
0
File: tests.py Project: wokli/yatte
 def test_text_node(self):
     tmpl = t('123')
     self.assertEquals(tmpl.render({}), '123')
Example #4
0
File: tests.py Project: wokli/yatte
 def test_if_node(self):
     tmpl = t('{%if a < 5 %}1{%end%}')
     self.assertEquals(tmpl.render({'a': 3}), '1')
     self.assertEquals(tmpl.render({'a': 9}), '')
Example #5
0
File: tests.py Project: wokli/yatte
 def test_each_node(self):
     tmpl = t('{%each var%}{{_}}{%end%}')
     self.assertEquals(tmpl.render({'var': range(3)}), '012')
Example #6
0
File: tests.py Project: wokli/yatte
 def test_var_node(self):
     tmpl = t('{{var}}')
     self.assertEquals(tmpl.render({'var': 'test'}), 'test')