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):
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):
......
......@@ -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):
......
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