From dec5054d6f0f486af6b305c50f97ffc922e57019 Mon Sep 17 00:00:00 2001 From: Chris Jerdonek Date: Sun, 1 Apr 2012 15:15:18 -0700 Subject: Removed the View class from the inverted.py example. --- examples/inverted.py | 9 ++++----- tests/test_template_spec.py | 12 +++++++----- 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): -- cgit v1.2.1