self.assertEquals(pystache.Template('{{#foo}}{{thing1}} and {{thing2}} and {{outer_thing}}{{/foo}}{{^foo}}Not foo!{{/foo}}',view).render(),"one and foo and two")
view.template='{{#foo}}{{thing1}} and {{thing2}} and {{outer_thing}}{{/foo}}{{^foo}}Not foo!{{/foo}}'
self.assertEquals(view.render(),"one and foo and two")
deftest_looping_and_negation_context(self):
deftest_looping_and_negation_context(self):
view=ComplexView()
view=ComplexView()
self.assertEquals(pystache.Template('{{#item}}{{header}}: {{name}} {{/item}}{{^item}} Shouldnt see me{{/item}}',view).render(),"Colors: red Colors: green Colors: blue ")
view.template='{{#item}}{{header}}: {{name}} {{/item}}{{^item}} Shouldnt see me{{/item}}'
self.assertEquals(view.render(),"Colors: red Colors: green Colors: blue ")
deftest_empty_context(self):
deftest_empty_context(self):
view=ComplexView()
view=ComplexView()
...
@@ -25,13 +25,16 @@ class TestSimple(unittest.TestCase):
...
@@ -25,13 +25,16 @@ class TestSimple(unittest.TestCase):
deftest_callables(self):
deftest_callables(self):
view=Lambdas()
view=Lambdas()
self.assertEquals(pystache.Template('{{#replace_foo_with_bar}}foo != bar. oh, it does!{{/replace_foo_with_bar}}',view).render(),'bar != bar. oh, it does!')
view.template='{{#replace_foo_with_bar}}foo != bar. oh, it does!{{/replace_foo_with_bar}}'
self.assertEquals(view.render(),'bar != bar. oh, it does!')