]> git.ipfire.org Git - thirdparty/jinja.git/commitdiff
fix random test for py2 734/head
authorDavid Lord <davidism@gmail.com>
Wed, 5 Jul 2017 18:17:09 +0000 (11:17 -0700)
committerDavid Lord <davidism@gmail.com>
Wed, 5 Jul 2017 18:17:09 +0000 (11:17 -0700)
add changelog

CHANGES
tests/test_filters.py

diff --git a/CHANGES b/CHANGES
index b12dd4f50f7c2e7bd7638449fc4536ca016d9e85..2441849b08a8c6dbce0057c208155f67196f62d7 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -22,6 +22,10 @@ Version 2.10
 - Added a `trimmed` modifier to `{% trans %}` to strip linebreaks and
   surrounding whitespace. Also added a new policy to enable this for all
   `trans` blocks.
+- The ``random`` filter is no longer incorrectly constant folded and will
+  produce a new random choice each time the template is rendered. (`#478`_)
+
+.. _#478: https://github.com/pallets/jinja/pull/478
 
 Version 2.9.6
 -------------
index 894ec29c4b4db39280ee300f1463128900e91e8b..54aa16b81023e3d6b9d131073a2d5eb529bdb7fb 100644 (file)
@@ -188,12 +188,12 @@ class TestFilter(object):
         state = random.getstate()
         request.addfinalizer(lambda: random.setstate(state))
         # generate the random values from a known seed
-        random.seed('jinja', version=2)
+        random.seed('jinja')
         expected = [random.choice('1234567890') for _ in range(10)]
 
         # check that the random sequence is generated again by a template
         # ensures that filter result is not constant folded
-        random.seed('jinja', version=2)
+        random.seed('jinja')
         t = env.from_string('{{ "1234567890"|random }}')
 
         for value in expected: