aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_template.py
diff options
context:
space:
mode:
authorCody Taylor <codemister99@yahoo.com>2015-03-24 20:57:02 -0400
committerCody Taylor <codemister99@yahoo.com>2015-03-24 20:57:47 -0400
commit52e8c0a3deaae9017c76a17196aeac8b027b933e (patch)
tree77179e4d936cd6e6de938ef98bc1e8fc5f88c0a1 /test/test_template.py
parentb6d0479034e4f379576caa6eb9ef3e32369c333f (diff)
downloadexternal_python_mako-52e8c0a3deaae9017c76a17196aeac8b027b933e.tar.gz
external_python_mako-52e8c0a3deaae9017c76a17196aeac8b027b933e.tar.bz2
external_python_mako-52e8c0a3deaae9017c76a17196aeac8b027b933e.zip
Add STOP_RENDERING keyword; exiting of a template.
Signed-off-by: Cody Taylor <codemister99@yahoo.com>
Diffstat (limited to 'test/test_template.py')
-rw-r--r--test/test_template.py17
1 files changed, 15 insertions, 2 deletions
diff --git a/test/test_template.py b/test/test_template.py
index c5873dc..a6a491f 100644
--- a/test/test_template.py
+++ b/test/test_template.py
@@ -757,9 +757,22 @@ class UndefinedVarsTest(TemplateTest):
['t is: T', 'a,b,c']
)
+class StopRenderingTest(TemplateTest):
+ def test_return_in_template(self):
+ t = Template("""
+ Line one
+ <% return STOP_RENDERING %>
+ Line Three
+ """, strict_undefined=True)
+
+ eq_(
+ result_lines(t.render()),
+ ['Line one']
+ )
+
class ReservedNameTest(TemplateTest):
def test_names_on_context(self):
- for name in ('context', 'loop', 'UNDEFINED'):
+ for name in ('context', 'loop', 'UNDEFINED', 'STOP_RENDERING'):
assert_raises_message(
exceptions.NameConflictError,
r"Reserved words passed to render\(\): %s" % name,
@@ -767,7 +780,7 @@ class ReservedNameTest(TemplateTest):
)
def test_names_in_template(self):
- for name in ('context', 'loop', 'UNDEFINED'):
+ for name in ('context', 'loop', 'UNDEFINED', 'STOP_RENDERING'):
assert_raises_message(
exceptions.NameConflictError,
r"Reserved words declared in template: %s" % name,