summaryrefslogtreecommitdiff
path: root/tests/template_tests/syntax_tests/test_firstof.py
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2014-12-21 21:19:05 +0100
committerClaude Paroz <claude@2xlibre.net>2014-12-30 18:16:25 +0100
commit51890ce8898f821d28f2f6fb6071c936e9bd88f0 (patch)
tree6522c597d411086b0a5c2ec3dd7a1d9bc2feeafd /tests/template_tests/syntax_tests/test_firstof.py
parent66f9a74b4514bd259976ce8ee3a4e78288358a5f (diff)
Applied ignore_warnings to Django tests
Diffstat (limited to 'tests/template_tests/syntax_tests/test_firstof.py')
-rw-r--r--tests/template_tests/syntax_tests/test_firstof.py24
1 files changed, 9 insertions, 15 deletions
diff --git a/tests/template_tests/syntax_tests/test_firstof.py b/tests/template_tests/syntax_tests/test_firstof.py
index c7c4434446..2c227f2304 100644
--- a/tests/template_tests/syntax_tests/test_firstof.py
+++ b/tests/template_tests/syntax_tests/test_firstof.py
@@ -1,7 +1,5 @@
-import warnings
-
from django.template import TemplateSyntaxError
-from django.test import SimpleTestCase
+from django.test import SimpleTestCase, ignore_warnings
from django.utils.deprecation import RemovedInDjango20Warning
from ..utils import setup
@@ -59,31 +57,27 @@ class FirstOfTagTests(SimpleTestCase):
output = self.engine.render_to_string('firstof10', {'a': '<'})
self.assertEqual(output, '&lt;')
+ @ignore_warnings(category=RemovedInDjango20Warning)
@setup({'firstof11': '{% load firstof from future %}{% firstof a b %}'})
def test_firstof11(self):
- with warnings.catch_warnings():
- warnings.simplefilter("ignore", RemovedInDjango20Warning)
- output = self.engine.render_to_string('firstof11', {'a': '<', 'b': '>'})
+ output = self.engine.render_to_string('firstof11', {'a': '<', 'b': '>'})
self.assertEqual(output, '&lt;')
+ @ignore_warnings(category=RemovedInDjango20Warning)
@setup({'firstof12': '{% load firstof from future %}{% firstof a b %}'})
def test_firstof12(self):
- with warnings.catch_warnings():
- warnings.simplefilter("ignore", RemovedInDjango20Warning)
- output = self.engine.render_to_string('firstof12', {'a': '', 'b': '>'})
+ output = self.engine.render_to_string('firstof12', {'a': '', 'b': '>'})
self.assertEqual(output, '&gt;')
+ @ignore_warnings(category=RemovedInDjango20Warning)
@setup({'firstof13': '{% load firstof from future %}'
'{% autoescape off %}{% firstof a %}{% endautoescape %}'})
def test_firstof13(self):
- with warnings.catch_warnings():
- warnings.simplefilter("ignore", RemovedInDjango20Warning)
- output = self.engine.render_to_string('firstof13', {'a': '<'})
+ output = self.engine.render_to_string('firstof13', {'a': '<'})
self.assertEqual(output, '<')
+ @ignore_warnings(category=RemovedInDjango20Warning)
@setup({'firstof14': '{% load firstof from future %}{% firstof a|safe b %}'})
def test_firstof14(self):
- with warnings.catch_warnings():
- warnings.simplefilter("ignore", RemovedInDjango20Warning)
- output = self.engine.render_to_string('firstof14', {'a': '<'})
+ output = self.engine.render_to_string('firstof14', {'a': '<'})
self.assertEqual(output, '<')