mirror of https://github.com/django/django.git
Used assertRaisesMessage() in {% for %} tests.
This commit is contained in:
parent
7d14889aa3
commit
9f16ea21c4
|
@ -71,17 +71,20 @@ class ForTagTests(SimpleTestCase):
|
|||
|
||||
@setup({'for-tag-unpack06': '{% for key value in items %}{{ key }}:{{ value }}/{% endfor %}'})
|
||||
def test_for_tag_unpack06(self):
|
||||
with self.assertRaises(TemplateSyntaxError):
|
||||
msg = "'for' tag received an invalid argument: for key value in items"
|
||||
with self.assertRaisesMessage(TemplateSyntaxError, msg):
|
||||
self.engine.render_to_string('for-tag-unpack06', {'items': (('one', 1), ('two', 2))})
|
||||
|
||||
@setup({'for-tag-unpack07': '{% for key,,value in items %}{{ key }}:{{ value }}/{% endfor %}'})
|
||||
def test_for_tag_unpack07(self):
|
||||
with self.assertRaises(TemplateSyntaxError):
|
||||
msg = "'for' tag received an invalid argument: for key,,value in items"
|
||||
with self.assertRaisesMessage(TemplateSyntaxError, msg):
|
||||
self.engine.render_to_string('for-tag-unpack07', {'items': (('one', 1), ('two', 2))})
|
||||
|
||||
@setup({'for-tag-unpack08': '{% for key,value, in items %}{{ key }}:{{ value }}/{% endfor %}'})
|
||||
def test_for_tag_unpack08(self):
|
||||
with self.assertRaises(TemplateSyntaxError):
|
||||
msg = "'for' tag received an invalid argument: for key,value, in items"
|
||||
with self.assertRaisesMessage(TemplateSyntaxError, msg):
|
||||
self.engine.render_to_string('for-tag-unpack08', {'items': (('one', 1), ('two', 2))})
|
||||
|
||||
@setup({'for-tag-unpack09': '{% for val in items %}{{ val.0 }}:{{ val.1 }}/{% endfor %}'})
|
||||
|
|
Loading…
Reference in New Issue