summaryrefslogtreecommitdiff
path: root/tests/test_examples.py
diff options
context:
space:
mode:
authorChris Jerdonek <chris.jerdonek@gmail.com>2012-03-19 18:00:16 -0700
committerChris Jerdonek <chris.jerdonek@gmail.com>2012-03-19 18:00:16 -0700
commit370d52544f3e316a041892fbf33710ce235e4915 (patch)
tree004545d1027d3c6b5681b76c1296c82604ba4442 /tests/test_examples.py
parent17d70ba678b3413a5934e09a8321885675f6238b (diff)
downloadpystache-370d52544f3e316a041892fbf33710ce235e4915.tar.gz
DoubleSection and Escaped tests no longer depend on pystache.View.
Diffstat (limited to 'tests/test_examples.py')
-rw-r--r--tests/test_examples.py17
1 files changed, 10 insertions, 7 deletions
diff --git a/tests/test_examples.py b/tests/test_examples.py
index 4493179..5c95de9 100644
--- a/tests/test_examples.py
+++ b/tests/test_examples.py
@@ -17,13 +17,16 @@ from tests.common import assert_strings
class TestView(unittest.TestCase):
- def test_comments(self):
+ def _assert(self, obj, expected):
renderer = Renderer()
- expected = renderer.render(Comments())
- self.assertEquals(expected, "<h1>A Comedy of Errors</h1>")
+ actual = renderer.render(obj)
+ assert_strings(self, actual, expected)
+
+ def test_comments(self):
+ self._assert(Comments(), "<h1>A Comedy of Errors</h1>")
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):
self.assertEquals(UnicodeOutput().render(), u'<p>Name: Henri Poincaré</p>')
@@ -33,7 +36,7 @@ class TestView(unittest.TestCase):
u'<p>If alive today, Henri Poincaré would be 156 years old.</p>')
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):
self.assertEquals(Unescaped().render(), "<h1>Bear > Shark</h1>")
@@ -52,8 +55,8 @@ Again, Welcome!""")
def test_delimiters(self):
renderer = Renderer()
- expected = renderer.render(Delimiters())
- assert_strings(self, expected, """\
+ actual = renderer.render(Delimiters())
+ assert_strings(self, actual, """\
* It worked the first time.
* And it worked the second time.
* Then, surprisingly, it worked the third time.