mirror of
https://github.com/django/django.git
synced 2025-08-03 10:34:04 +00:00
Refs #24451 -- Removed comma-separated {% cycle %} syntax per deprecation timeline.
This commit is contained in:
parent
04ee4059d7
commit
27b2321793
3 changed files with 1 additions and 54 deletions
|
@ -1,6 +1,5 @@
|
|||
from django.template import TemplateSyntaxError
|
||||
from django.test import SimpleTestCase, ignore_warnings
|
||||
from django.utils.deprecation import RemovedInDjango110Warning
|
||||
from django.test import SimpleTestCase
|
||||
|
||||
from ..utils import setup
|
||||
|
||||
|
@ -12,24 +11,6 @@ class CycleTagTests(SimpleTestCase):
|
|||
with self.assertRaises(TemplateSyntaxError):
|
||||
self.engine.get_template('cycle01')
|
||||
|
||||
@ignore_warnings(category=RemovedInDjango110Warning)
|
||||
@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=RemovedInDjango110Warning)
|
||||
@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=RemovedInDjango110Warning)
|
||||
@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')
|
||||
self.assertEqual(output, 'abca')
|
||||
|
||||
@setup({'cycle05': '{% cycle %}'})
|
||||
def test_cycle05(self):
|
||||
with self.assertRaises(TemplateSyntaxError):
|
||||
|
@ -40,24 +21,11 @@ class CycleTagTests(SimpleTestCase):
|
|||
with self.assertRaises(TemplateSyntaxError):
|
||||
self.engine.get_template('cycle06')
|
||||
|
||||
@ignore_warnings(category=RemovedInDjango110Warning)
|
||||
@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=RemovedInDjango110Warning)
|
||||
@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=RemovedInDjango110Warning)
|
||||
@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))})
|
||||
self.assertEqual(output, 'a0,b1,a2,b3,a4,')
|
||||
|
||||
@setup({'cycle10': "{% cycle 'a' 'b' 'c' as abc %}{% cycle abc %}"})
|
||||
def test_cycle10(self):
|
||||
output = self.engine.render_to_string('cycle10')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue