From: David Lord Date: Wed, 5 Jul 2017 18:17:09 +0000 (-0700) Subject: fix random test for py2 X-Git-Tag: 2.10~21^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2e15e52adf0c07028501f64cb8d15f70bf64bce8;p=thirdparty%2Fjinja.git fix random test for py2 add changelog --- diff --git a/CHANGES b/CHANGES index b12dd4f5..2441849b 100644 --- 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 ------------- diff --git a/tests/test_filters.py b/tests/test_filters.py index 894ec29c..54aa16b8 100644 --- a/tests/test_filters.py +++ b/tests/test_filters.py @@ -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: