Skip to content

Commit b7500c8

Browse files
committed
Add tests of {% now %}
1 parent b337234 commit b7500c8

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
@@ -156,6 +156,26 @@ def test_lorem(self):
156156
self.assertEqual(text, "First\nlorem ipsum dolor\nLast\n")
157157
self.assert_analysis([1, 2, 3])
158158

159+
def test_now(self):
160+
self.make_template("""\
161+
Now:
162+
{% now "\\n\\o\\w" %}
163+
.
164+
""")
165+
text = self.run_django_coverage()
166+
self.assertEqual(text, "Now:\nnow\n.\n")
167+
self.assert_analysis([1, 2, 3])
168+
169+
@needs_django(1, 8)
170+
def test_now_as(self):
171+
self.make_template("""\
172+
{% now "\\n\\o\\w" as right_now %}
173+
Now it's {{ right_now }}.
174+
""")
175+
text = self.run_django_coverage()
176+
self.assertEqual(text, "\nNow it's now.\n")
177+
self.assert_analysis([1, 2])
178+
159179

160180
class StringTemplateTest(DjangoPluginTestCase):
161181

0 commit comments

Comments
 (0)