1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Fixed #24451 -- Deprecated comma-separated {% cycle %} syntax.

This commit is contained in:
Tim Graham
2015-03-05 12:38:42 -05:00
parent 88c605e3e3
commit c36b60836b
6 changed files with 36 additions and 10 deletions

View File

@@ -12,16 +12,19 @@ class CycleTagTests(SimpleTestCase):
with self.assertRaises(TemplateSyntaxError):
self.engine.get_template('cycle01')
@ignore_warnings(category=RemovedInDjango20Warning)
@setup({'cycle02': '{% cycle a,b,c as abc %}{% cycle abc %}'})
def test_cycle02(self):
output = self.engine.render_to_string('cycle02')
self.assertEqual(output, 'ab')
@ignore_warnings(category=RemovedInDjango20Warning)
@setup({'cycle03': '{% cycle a,b,c as abc %}{% cycle abc %}{% cycle abc %}'})
def test_cycle03(self):
output = self.engine.render_to_string('cycle03')
self.assertEqual(output, 'abc')
@ignore_warnings(category=RemovedInDjango20Warning)
@setup({'cycle04': '{% cycle a,b,c as abc %}{% cycle abc %}{% cycle abc %}{% cycle abc %}'})
def test_cycle04(self):
output = self.engine.render_to_string('cycle04')
@@ -37,16 +40,19 @@ class CycleTagTests(SimpleTestCase):
with self.assertRaises(TemplateSyntaxError):
self.engine.get_template('cycle06')
@ignore_warnings(category=RemovedInDjango20Warning)
@setup({'cycle07': '{% cycle a,b,c as foo %}{% cycle bar %}'})
def test_cycle07(self):
with self.assertRaises(TemplateSyntaxError):
self.engine.get_template('cycle07')
@ignore_warnings(category=RemovedInDjango20Warning)
@setup({'cycle08': '{% cycle a,b,c as foo %}{% cycle foo %}{{ foo }}{{ foo }}{% cycle foo %}{{ foo }}'})
def test_cycle08(self):
output = self.engine.render_to_string('cycle08')
self.assertEqual(output, 'abbbcc')
@ignore_warnings(category=RemovedInDjango20Warning)
@setup({'cycle09': '{% for i in test %}{% cycle a,b %}{{ i }},{% endfor %}'})
def test_cycle09(self):
output = self.engine.render_to_string('cycle09', {'test': list(range(5))})