Commit ff48880a by Chris Jerdonek

Made sure that View.template does not get overwritten by the constructor.

parent ec120d99
......@@ -53,7 +53,8 @@ class View(object):
if load_template is not None:
self._load_template = load_template
self.template = template
if template is not None:
self.template = template
context = context or {}
context.update(**kwargs)
......
......@@ -5,11 +5,26 @@ from examples.simple import Simple
from examples.complex_view import ComplexView
from examples.lambdas import Lambdas
from examples.inverted import Inverted, InvertedLists
from pystache.view import View
class Thing(object):
pass
class TestView(unittest.TestCase):
class ViewTestCase(unittest.TestCase):
def test_init(self):
"""
Test the constructor.
"""
class TestView(View):
template = "foo"
view = TestView()
self.assertEquals(view.template, "foo")
def test_basic(self):
view = Simple("Hi {{thing}}!", { 'thing': 'world' })
self.assertEquals(view.render(), "Hi world!")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment