Commit 370d5254 by Chris Jerdonek

DoubleSection and Escaped tests no longer depend on pystache.View.

parent 17d70ba6
import pystache class DoubleSection(object):
class DoubleSection(pystache.View):
template_path = 'examples'
def t(self): def t(self):
return True return True
......
import pystache class Escaped(object):
class Escaped(pystache.View):
template_path = 'examples'
def title(self): def title(self):
return "Bear > Shark" return "Bear > Shark"
...@@ -17,13 +17,16 @@ from tests.common import assert_strings ...@@ -17,13 +17,16 @@ from tests.common import assert_strings
class TestView(unittest.TestCase): class TestView(unittest.TestCase):
def test_comments(self): def _assert(self, obj, expected):
renderer = Renderer() renderer = Renderer()
expected = renderer.render(Comments()) actual = renderer.render(obj)
self.assertEquals(expected, "<h1>A Comedy of Errors</h1>") assert_strings(self, actual, expected)
def test_comments(self):
self._assert(Comments(), "<h1>A Comedy of Errors</h1>")
def test_double_section(self): def test_double_section(self):
self.assertEquals(DoubleSection().render(),"""* first\n* second\n* third""") self._assert(DoubleSection(), "* first\n* second\n* third")
def test_unicode_output(self): def test_unicode_output(self):
self.assertEquals(UnicodeOutput().render(), u'<p>Name: Henri Poincaré</p>') self.assertEquals(UnicodeOutput().render(), u'<p>Name: Henri Poincaré</p>')
...@@ -33,7 +36,7 @@ class TestView(unittest.TestCase): ...@@ -33,7 +36,7 @@ class TestView(unittest.TestCase):
u'<p>If alive today, Henri Poincaré would be 156 years old.</p>') u'<p>If alive today, Henri Poincaré would be 156 years old.</p>')
def test_escaping(self): def test_escaping(self):
self.assertEquals(Escaped().render(), "<h1>Bear &gt; Shark</h1>") self._assert(Escaped(), "<h1>Bear &gt; Shark</h1>")
def test_literal(self): def test_literal(self):
self.assertEquals(Unescaped().render(), "<h1>Bear > Shark</h1>") self.assertEquals(Unescaped().render(), "<h1>Bear > Shark</h1>")
...@@ -52,8 +55,8 @@ Again, Welcome!""") ...@@ -52,8 +55,8 @@ Again, Welcome!""")
def test_delimiters(self): def test_delimiters(self):
renderer = Renderer() renderer = Renderer()
expected = renderer.render(Delimiters()) actual = renderer.render(Delimiters())
assert_strings(self, expected, """\ assert_strings(self, actual, """\
* It worked the first time. * It worked the first time.
* And it worked the second time. * And it worked the second time.
* Then, surprisingly, it worked the third time. * Then, surprisingly, it worked the third time.
......
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