From 51890ce8898f821d28f2f6fb6071c936e9bd88f0 Mon Sep 17 00:00:00 2001 From: Claude Paroz Date: Sun, 21 Dec 2014 21:19:05 +0100 Subject: Applied ignore_warnings to Django tests --- tests/template_tests/syntax_tests/test_firstof.py | 24 +++++++++-------------- 1 file changed, 9 insertions(+), 15 deletions(-) (limited to 'tests/template_tests/syntax_tests/test_firstof.py') 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, '<') + @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, '<') + @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, '>') + @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, '<') -- cgit v1.3