summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Jerdonek <chris.jerdonek@gmail.com>2012-04-01 15:15:18 -0700
committerChris Jerdonek <chris.jerdonek@gmail.com>2012-04-01 15:15:18 -0700
commitdec5054d6f0f486af6b305c50f97ffc922e57019 (patch)
tree29291d8d7503a7db89843eccc4bb943b67770c5c
parent9b6b76c4926ef812ee4892b4325ea8d3b98fb236 (diff)
downloadpystache-dec5054d6f0f486af6b305c50f97ffc922e57019.tar.gz
Removed the View class from the inverted.py example.
-rw-r--r--examples/inverted.py9
-rw-r--r--tests/test_template_spec.py12
2 files changed, 11 insertions, 10 deletions
diff --git a/examples/inverted.py b/examples/inverted.py
index e0f7aaf..2a05302 100644
--- a/examples/inverted.py
+++ b/examples/inverted.py
@@ -1,7 +1,6 @@
-import pystache
+from pystache import TemplateSpec
-class Inverted(pystache.View):
- template_path = 'examples'
+class Inverted(object):
def t(self):
return True
@@ -14,11 +13,11 @@ class Inverted(pystache.View):
def empty_list(self):
return []
-
+
def populated_list(self):
return ['some_value']
-class InvertedLists(Inverted):
+class InvertedLists(Inverted, TemplateSpec):
template_name = 'inverted'
def t(self):
diff --git a/tests/test_template_spec.py b/tests/test_template_spec.py
index b3d7093..5bb8210 100644
--- a/tests/test_template_spec.py
+++ b/tests/test_template_spec.py
@@ -30,7 +30,7 @@ class Thing(object):
pass
-class ViewTestCase(unittest.TestCase):
+class ViewTestCase(unittest.TestCase, AssertStringMixin):
def test_init(self):
"""
@@ -119,8 +119,9 @@ class ViewTestCase(unittest.TestCase):
self.assertEquals(view.render(), 'nopqrstuvwxyznopqrstuvwxyz')
def test_inverted(self):
- view = Inverted()
- self.assertEquals(view.render(), """one, two, three, empty list""")
+ renderer = Renderer()
+ expected = renderer.render(Inverted())
+ self.assertString(expected, u"""one, two, three, empty list""")
def test_accessing_properties_on_parent_object_from_child_objects(self):
parent = Thing()
@@ -132,8 +133,9 @@ class ViewTestCase(unittest.TestCase):
self.assertEquals(view.render(), 'derp')
def test_inverted_lists(self):
- view = InvertedLists()
- self.assertEquals(view.render(), """one, two, three, empty list""")
+ renderer = Renderer()
+ expected = renderer.render(InvertedLists())
+ self.assertString(expected, u"""one, two, three, empty list""")
class SpecLoaderTests(unittest.TestCase, AssertIsMixin, AssertStringMixin):