summaryrefslogtreecommitdiff
path: root/pystache
diff options
context:
space:
mode:
authorChris Jerdonek <chris.jerdonek@gmail.com>2012-04-25 18:57:55 -0700
committerChris Jerdonek <chris.jerdonek@gmail.com>2012-04-25 18:57:55 -0700
commit39a0d59144fb53f623054730d6e0c13136b9a7f1 (patch)
tree71d6b400d4c2859600258c43096920fddf6f4b42 /pystache
parent340c2991635e1c4330ebd329260de56754a01ec6 (diff)
downloadpystache-39a0d59144fb53f623054730d6e0c13136b9a7f1.tar.gz
Add RenderEngine test cases for "falsey" context values.
Diffstat (limited to 'pystache')
-rw-r--r--pystache/tests/test_renderengine.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/pystache/tests/test_renderengine.py b/pystache/tests/test_renderengine.py
index d1f1a1d..e5dbfcc 100644
--- a/pystache/tests/test_renderengine.py
+++ b/pystache/tests/test_renderengine.py
@@ -204,6 +204,27 @@ class RenderTests(unittest.TestCase, AssertStringMixin):
context = {'test': '{{#hello}}'}
self._assert_render(u'{{#hello}}', template, context)
+ ## Test interpolation with "falsey" values
+ #
+ # In these test cases, we test the part of the spec that says that
+ # "data should be coerced into a string (and escaped, if appropriate)
+ # before interpolation." We test this for data that is "falsey."
+
+ def test_interpolation__falsey__zero(self):
+ template = '{{.}}'
+ context = 0
+ self._assert_render(u'0', template, context)
+
+ def test_interpolation__falsey__none(self):
+ template = '{{.}}'
+ context = None
+ self._assert_render(u'None', template, context)
+
+ def test_interpolation__falsey__zero(self):
+ template = '{{.}}'
+ context = False
+ self._assert_render(u'False', template, context)
+
# Built-in types:
#
# Confirm that we not treat instances of built-in types as objects,