diff --git a/examples/inner_partial.mustache b/examples/inner_partial.mustache new file mode 100644 index 00000000..2863764e --- /dev/null +++ b/examples/inner_partial.mustache @@ -0,0 +1 @@ +Again, {{title}}! \ No newline at end of file diff --git a/examples/template_partial.mustache b/examples/template_partial.mustache new file mode 100644 index 00000000..03f76cfa --- /dev/null +++ b/examples/template_partial.mustache @@ -0,0 +1,2 @@ +

{{title}}

+{{>inner_partial}} \ No newline at end of file diff --git a/examples/template_partial.py b/examples/template_partial.py new file mode 100644 index 00000000..de8e1255 --- /dev/null +++ b/examples/template_partial.py @@ -0,0 +1,10 @@ +import pystache + +class TemplatePartial(pystache.View): + template_path = 'examples' + + def title(self): + return "Welcome" + + def title_bars(self): + return '-' * title.size diff --git a/tests/test_examples.py b/tests/test_examples.py index ae7d223e..2246129e 100644 --- a/tests/test_examples.py +++ b/tests/test_examples.py @@ -5,6 +5,7 @@ from examples.double_section import DoubleSection from examples.escaped import Escaped from examples.unescaped import Unescaped +from examples.template_partial import TemplatePartial class TestView(unittest.TestCase): def test_comments(self): @@ -22,3 +23,5 @@ def test_escaped(self): def test_unescaped(self): self.assertEquals(Unescaped().render(), "

Bear > Shark

") + def test_template_partial(self): + self.assertEquals(TemplatePartial().render(), 'blah')