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_cycle.py | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'tests/template_tests/syntax_tests/test_cycle.py') diff --git a/tests/template_tests/syntax_tests/test_cycle.py b/tests/template_tests/syntax_tests/test_cycle.py index 8a47ff8879..88a7187b1a 100644 --- a/tests/template_tests/syntax_tests/test_cycle.py +++ b/tests/template_tests/syntax_tests/test_cycle.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 @@ -141,24 +139,21 @@ class CycleTagTests(SimpleTestCase): output = self.engine.render_to_string('cycle25', {'a': '<'}) self.assertEqual(output, '<') + @ignore_warnings(category=RemovedInDjango20Warning) @setup({'cycle26': '{% load cycle from future %}{% cycle a b as ab %}{% cycle ab %}'}) def test_cycle26(self): - with warnings.catch_warnings(): - warnings.simplefilter("ignore", RemovedInDjango20Warning) - output = self.engine.render_to_string('cycle26', {'a': '<', 'b': '>'}) + output = self.engine.render_to_string('cycle26', {'a': '<', 'b': '>'}) self.assertEqual(output, '<>') + @ignore_warnings(category=RemovedInDjango20Warning) @setup({'cycle27': '{% load cycle from future %}' '{% autoescape off %}{% cycle a b as ab %}{% cycle ab %}{% endautoescape %}'}) def test_cycle27(self): - with warnings.catch_warnings(): - warnings.simplefilter("ignore", RemovedInDjango20Warning) - output = self.engine.render_to_string('cycle27', {'a': '<', 'b': '>'}) + output = self.engine.render_to_string('cycle27', {'a': '<', 'b': '>'}) self.assertEqual(output, '<>') + @ignore_warnings(category=RemovedInDjango20Warning) @setup({'cycle28': '{% load cycle from future %}{% cycle a|safe b as ab %}{% cycle ab %}'}) def test_cycle28(self): - with warnings.catch_warnings(): - warnings.simplefilter("ignore", RemovedInDjango20Warning) - output = self.engine.render_to_string('cycle28', {'a': '<', 'b': '>'}) + output = self.engine.render_to_string('cycle28', {'a': '<', 'b': '>'}) self.assertEqual(output, '<>') -- cgit v1.3