Beispiel #1
0
 def test_render_fragments_scopes(self):
     template = 'Hello, {{test.test1}}!'
     data0 = {'test': {'test0': '0', 'test2': 'ok'}}
     data1 = {'test': {'test0': '0', 'test1': 'ok'}}
     scopes = [data0, data1]
     fragments = mite.compile(template)
     rendered = mite.render(fragments=fragments, scopes=scopes)
     self.assertEqual(rendered, 'Hello, ok!')
Beispiel #2
0
 def test_compile_unbalanced_right_space(self):
     template = '{{ }'
     fragments = mite.compile(template)
     self.assertEqual(fragments, [(mite.FRAG_TEXT, '{{ }')])
Beispiel #3
0
 def test_compile_fragments_var_text(self):
     template = '{{{  test0 }}'
     fragments = mite.compile(template)
     self.assertEqual(fragments, [(mite.FRAG_TEXT, '{'),
                                  (mite.FRAG_VAR, 'test0')])
Beispiel #4
0
 def test_compile_empty(self):
     self.assertEqual(mite.compile(), [])