Skip to content

Commit 935ad0d

Browse files
committed
Test the last two built-in tags: {% widthratio %} and {% with %}
1 parent c9fa6f4 commit 935ad0d

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

tests/test_simple.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ def test_inline_comment(self):
111111

112112

113113
class OtherTest(DjangoPluginTestCase):
114+
"""Tests of miscellaneous tags."""
114115

115116
def test_autoescape(self):
116117
self.make_template("""\
@@ -223,6 +224,25 @@ def test_verbatim(self):
223224
)
224225
self.assert_analysis([1, 2, 3, 4, 5, 7])
225226

227+
def test_widthratio(self):
228+
self.make_template("""\
229+
{% widthratio 175 200 100 %}
230+
== 88
231+
""")
232+
text = self.run_django_coverage()
233+
self.assertEqual(text, "88\n== 88\n")
234+
self.assert_analysis([1, 2])
235+
236+
def test_with(self):
237+
self.make_template("""\
238+
{% with alpha=1 beta=2 %}
239+
alpha = {{ alpha }}, beta = {{ beta }}.
240+
{% endwith %}
241+
""")
242+
text = self.run_django_coverage()
243+
self.assertEqual(text, "\nalpha = 1, beta = 2.\n\n")
244+
self.assert_analysis([1, 2])
245+
226246

227247
class StringTemplateTest(DjangoPluginTestCase):
228248

0 commit comments

Comments
 (0)