Commit dec5054d by Chris Jerdonek

Removed the View class from the inverted.py example.

parent 9b6b76c4
import pystache from pystache import TemplateSpec
class Inverted(pystache.View): class Inverted(object):
template_path = 'examples'
def t(self): def t(self):
return True return True
...@@ -14,11 +13,11 @@ class Inverted(pystache.View): ...@@ -14,11 +13,11 @@ class Inverted(pystache.View):
def empty_list(self): def empty_list(self):
return [] return []
def populated_list(self): def populated_list(self):
return ['some_value'] return ['some_value']
class InvertedLists(Inverted): class InvertedLists(Inverted, TemplateSpec):
template_name = 'inverted' template_name = 'inverted'
def t(self): def t(self):
......
...@@ -30,7 +30,7 @@ class Thing(object): ...@@ -30,7 +30,7 @@ class Thing(object):
pass pass
class ViewTestCase(unittest.TestCase): class ViewTestCase(unittest.TestCase, AssertStringMixin):
def test_init(self): def test_init(self):
""" """
...@@ -119,8 +119,9 @@ class ViewTestCase(unittest.TestCase): ...@@ -119,8 +119,9 @@ class ViewTestCase(unittest.TestCase):
self.assertEquals(view.render(), 'nopqrstuvwxyznopqrstuvwxyz') self.assertEquals(view.render(), 'nopqrstuvwxyznopqrstuvwxyz')
def test_inverted(self): def test_inverted(self):
view = Inverted() renderer = Renderer()
self.assertEquals(view.render(), """one, two, three, empty list""") expected = renderer.render(Inverted())
self.assertString(expected, u"""one, two, three, empty list""")
def test_accessing_properties_on_parent_object_from_child_objects(self): def test_accessing_properties_on_parent_object_from_child_objects(self):
parent = Thing() parent = Thing()
...@@ -132,8 +133,9 @@ class ViewTestCase(unittest.TestCase): ...@@ -132,8 +133,9 @@ class ViewTestCase(unittest.TestCase):
self.assertEquals(view.render(), 'derp') self.assertEquals(view.render(), 'derp')
def test_inverted_lists(self): def test_inverted_lists(self):
view = InvertedLists() renderer = Renderer()
self.assertEquals(view.render(), """one, two, three, empty list""") expected = renderer.render(InvertedLists())
self.assertString(expected, u"""one, two, three, empty list""")
class SpecLoaderTests(unittest.TestCase, AssertIsMixin, AssertStringMixin): class SpecLoaderTests(unittest.TestCase, AssertIsMixin, AssertStringMixin):
......
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