summaryrefslogtreecommitdiff
path: root/tests/template_tests/filter_tests/test_chaining.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/template_tests/filter_tests/test_chaining.py')
-rw-r--r--tests/template_tests/filter_tests/test_chaining.py21
1 files changed, 17 insertions, 4 deletions
diff --git a/tests/template_tests/filter_tests/test_chaining.py b/tests/template_tests/filter_tests/test_chaining.py
index 9bc3976f37..453e2a335f 100644
--- a/tests/template_tests/filter_tests/test_chaining.py
+++ b/tests/template_tests/filter_tests/test_chaining.py
@@ -1,4 +1,7 @@
-from django.test import SimpleTestCase
+import warnings
+
+from django.test import SimpleTestCase, ignore_warnings
+from django.utils.deprecation import RemovedInDjango20Warning
from django.utils.safestring import mark_safe
from ..utils import setup
@@ -38,9 +41,19 @@ class ChainingTests(SimpleTestCase):
# Using a filter that forces safeness does not lead to double-escaping
@setup({'chaining05': '{{ a|escape|capfirst }}'})
def test_chaining05(self):
- output = self.engine.render_to_string('chaining05', {'a': 'a < b'})
- self.assertEqual(output, 'A &lt; b')
-
+ with warnings.catch_warnings(record=True) as warns:
+ warnings.simplefilter('always')
+ output = self.engine.render_to_string('chaining05', {'a': 'a < b'})
+ self.assertEqual(output, 'A &lt; b')
+
+ self.assertEqual(len(warns), 1)
+ self.assertEqual(
+ str(warns[0].message),
+ "escape isn't the last filter in ['escape_filter', 'capfirst'] and "
+ "will be applied immediately in Django 2.0 so the output may change."
+ )
+
+ @ignore_warnings(category=RemovedInDjango20Warning)
@setup({'chaining06': '{% autoescape off %}{{ a|escape|capfirst }}{% endautoescape %}'})
def test_chaining06(self):
output = self.engine.render_to_string('chaining06', {'a': 'a < b'})