def test_nested_context(self): renderer = Renderer() view = NestedContext(renderer) view.template = '{{#foo}}{{thing1}} and {{thing2}} and {{outer_thing}}{{/foo}}{{^foo}}Not foo!{{/foo}}' actual = renderer.render(view) self.assertString(actual, "one and foo and two")
def test_nested_context_is_available_in_view(self): renderer = Renderer() view = NestedContext(renderer) view.template = '{{#herp}}{{#derp}}{{nested_context_in_view}}{{/derp}}{{/herp}}' actual = renderer.render(view) self.assertString(actual, 'it works!')
def test_nested_context(self): renderer = Renderer() actual = renderer.render(NestedContext(renderer)) self.assertString(actual, "one and foo and two")