summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Phalip <jphalip@gmail.com>2013-02-24 13:47:14 -0800
committerJulien Phalip <jphalip@gmail.com>2013-02-24 13:47:14 -0800
commitae2a8bb4569e569d0cc2cd8173443862418d3698 (patch)
tree9fc4670f36774dda7b83af1fcc9ffc240b04eccc
parenta8449d436210d19d77a6710f44f44e2d8f924214 (diff)
Fixed a test that was failing in Python 3.
The issue was that as of Python 3, the generators' `next()` method becomes `__next()`. Thanks Alex Gaynor for noticing that. Refs #19890.
-rw-r--r--tests/regressiontests/templates/tests.py11
1 files changed, 3 insertions, 8 deletions
diff --git a/tests/regressiontests/templates/tests.py b/tests/regressiontests/templates/tests.py
index e1e448acba..176972fb25 100644
--- a/tests/regressiontests/templates/tests.py
+++ b/tests/regressiontests/templates/tests.py
@@ -444,14 +444,9 @@ class Templates(TestCase):
def test_ifchanged_render_once(self):
""" Test for ticket #19890. The content of ifchanged template tag was
rendered twice."""
-
- template = Template('{% ifchanged %}{{ gen.next }}{% endifchanged %}')
- def gen():
- for i in xrange(1,10):
- yield 'iteration no %d' % i
-
- output = template.render(Context({'gen': gen()}))
- self.assertEqual(output, 'iteration no 1')
+ template = Template('{% ifchanged %}{% cycle "1st time" "2nd time" %}{% endifchanged %}')
+ output = template.render(Context({}))
+ self.assertEqual(output, '1st time')
def test_templates(self):
template_tests = self.get_template_tests()