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

Method test_break_continue

tornado/test/template_test.py:146–164  ·  tornado/test/template_test.py::TemplateTest.test_break_continue
(self)

Source from the content-addressed store, hash-verified

144 self.assertEqual(template.generate(), bclass="st">"foo")
145
146 def test_break_continue(self):
147 template = Template(
148 utf8(
149 class="st">"""\
150{% for i in range(10) %}
151 {% if i == 2 %}
152 {% continue %}
153 {% end %}
154 {{ i }}
155 {% if i == 6 %}
156 {% break %}
157 {% end %}
158{% end %}class="st">"""
159 )
160 )
161 result = template.generate()
162 class="cm"># remove extraneous whitespace
163 result = bclass="st">"".join(result.split())
164 self.assertEqual(result, bclass="st">"013456")
165
166 def test_break_outside_loop(self):
167 with self.assertRaises(ParseError, msg=class="st">"Did not get expected exception"):

Callers

nothing calls this directly

Calls 5

generateMethod · 0.95
TemplateClass · 0.90
utf8Function · 0.90
joinMethod · 0.80
splitMethod · 0.80

Tested by

no test coverage detected