def test_complex(self):
     self.assertEquals(ten.precompile(
         tags.html[
             tags.head[
                 tags.title["Hi"]],
             tags.body[
                 tags.div(style="color:red")["Bye"]]]),
         ['<html><head><title>Hi</title></head><body><div style="color:red">Bye</div></body></html>'])
Exemple #2
0
 def test_tagWithRender(self):
     render = lambda c, d: 'body'
     result = ten.precompile(tags.html[tags.body(render=render)])
     prelude, dynamic, postlude = result
     self.assertEqual(prelude, '<html>')
     self.assertEqual(dynamic.tag.render, render)
     self.assertEqual(postlude, '</html>')
     self.assertEqual(ten.flatten(result), '<html>body</html>')
Exemple #3
0
 def test_dynamic(self):
     render = lambda c, d: 'one'
     result = ten.precompile(tags.html[render])
     prelude, dynamic, postlude = result
     self.assertEqual(prelude, '<html>')
     self.assertEqual(dynamic.tag.render, render)
     self.assertEqual(postlude, '</html>')
     self.assertEqual(ten.flatten(result), '<html>one</html>')
Exemple #4
0
 def test_tagWithRender(self):
     render = lambda c, d: 'body'
     result = ten.precompile(
         tags.html[
             tags.body(render=render)])
     prelude, dynamic, postlude = result
     self.assertEquals(prelude, '<html>')
     self.assertEquals(dynamic.tag.render, render)
     self.assertEquals(postlude, '</html>')
     self.assertEquals(ten.flatten(result), '<html>body</html>')
Exemple #5
0
 def test_dynamic(self):
     render = lambda c, d: 'one'
     result = ten.precompile(
         tags.html[
             render])
     prelude, dynamic, postlude = result
     self.assertEquals(prelude, '<html>')
     self.assertEquals(dynamic.tag.render, render)
     self.assertEquals(postlude, '</html>')
     self.assertEquals(ten.flatten(result), '<html>one</html>')
 def test_simple(self):
     self.assertEquals(ten.precompile(1), ['1'])