MCPcopy
hub / github.com/tornadoweb/tornado / test_try

Method test_try

tornado/test/template_test.py:128–140  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

126 self.assertEqual(template.generate(), b"")
127
128 def test_try(self):
129 template = Template(
130 utf8(
131 """{% try %}
132try{% set y = 1/x %}
133{% except %}-except
134{% else %}-else
135{% finally %}-finally
136{% end %}"""
137 )
138 )
139 self.assertEqual(template.generate(x=1), b"\ntry\n-else\n-finally\n")
140 self.assertEqual(template.generate(x=0), b"\ntry-except\n-finally\n")
141
142 def test_comment_directive(self):
143 template = Template(utf8("{% comment blah blah %}foo"))

Callers

nothing calls this directly

Calls 3

generateMethod · 0.95
TemplateClass · 0.90
utf8Function · 0.90

Tested by

no test coverage detected