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!')
def test_compile_unbalanced_right_space(self): template = '{{ }' fragments = mite.compile(template) self.assertEqual(fragments, [(mite.FRAG_TEXT, '{{ }')])
def test_compile_fragments_var_text(self): template = '{{{ test0 }}' fragments = mite.compile(template) self.assertEqual(fragments, [(mite.FRAG_TEXT, '{'), (mite.FRAG_VAR, 'test0')])
def test_compile_empty(self): self.assertEqual(mite.compile(), [])