Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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.
  • Loading branch information...
commit ae2a8bb4569e569d0cc2cd8173443862418d3698 1 parent a8449d4
@jphalip jphalip authored
Showing with 3 additions and 8 deletions.
  1. +3 −8 tests/regressiontests/templates/tests.py
View
11 tests/regressiontests/templates/tests.py
@@ -444,14 +444,9 @@ def gen():
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()
Please sign in to comment.
Something went wrong with that request. Please try again.