Renamed RemovedInDjangoXYWarnings for new roadmap.

Forwardport of ae1d663b79
from stable/1.8.x plus more.
This commit is contained in:
Tim Graham 2015-06-22 13:54:35 -04:00
parent e73842a95f
commit aaacaeb096
124 changed files with 455 additions and 448 deletions

View file

@ -1,6 +1,6 @@
from django.template import TemplateSyntaxError
from django.test import SimpleTestCase, ignore_warnings
from django.utils.deprecation import RemovedInDjango20Warning
from django.utils.deprecation import RemovedInDjango110Warning
from ..utils import setup
@ -13,19 +13,19 @@ class CycleTagTests(SimpleTestCase):
with self.assertRaises(TemplateSyntaxError):
self.engine.get_template('cycle01')
@ignore_warnings(category=RemovedInDjango20Warning)
@ignore_warnings(category=RemovedInDjango110Warning)
@setup({'cycle02': '{% cycle a,b,c as abc %}{% cycle abc %}'})
def test_cycle02(self):
output = self.engine.render_to_string('cycle02')
self.assertEqual(output, 'ab')
@ignore_warnings(category=RemovedInDjango20Warning)
@ignore_warnings(category=RemovedInDjango110Warning)
@setup({'cycle03': '{% cycle a,b,c as abc %}{% cycle abc %}{% cycle abc %}'})
def test_cycle03(self):
output = self.engine.render_to_string('cycle03')
self.assertEqual(output, 'abc')
@ignore_warnings(category=RemovedInDjango20Warning)
@ignore_warnings(category=RemovedInDjango110Warning)
@setup({'cycle04': '{% cycle a,b,c as abc %}{% cycle abc %}{% cycle abc %}{% cycle abc %}'})
def test_cycle04(self):
output = self.engine.render_to_string('cycle04')
@ -41,19 +41,19 @@ class CycleTagTests(SimpleTestCase):
with self.assertRaises(TemplateSyntaxError):
self.engine.get_template('cycle06')
@ignore_warnings(category=RemovedInDjango20Warning)
@ignore_warnings(category=RemovedInDjango110Warning)
@setup({'cycle07': '{% cycle a,b,c as foo %}{% cycle bar %}'})
def test_cycle07(self):
with self.assertRaises(TemplateSyntaxError):
self.engine.get_template('cycle07')
@ignore_warnings(category=RemovedInDjango20Warning)
@ignore_warnings(category=RemovedInDjango110Warning)
@setup({'cycle08': '{% cycle a,b,c as foo %}{% cycle foo %}{{ foo }}{{ foo }}{% cycle foo %}{{ foo }}'})
def test_cycle08(self):
output = self.engine.render_to_string('cycle08')
self.assertEqual(output, 'abbbcc')
@ignore_warnings(category=RemovedInDjango20Warning)
@ignore_warnings(category=RemovedInDjango110Warning)
@setup({'cycle09': '{% for i in test %}{% cycle a,b %}{{ i }},{% endfor %}'})
def test_cycle09(self):
output = self.engine.render_to_string('cycle09', {'test': list(range(5))})
@ -146,20 +146,20 @@ class CycleTagTests(SimpleTestCase):
output = self.engine.render_to_string('cycle25', {'a': '<'})
self.assertEqual(output, '&lt;')
@ignore_warnings(category=RemovedInDjango20Warning)
@ignore_warnings(category=RemovedInDjango110Warning)
@setup({'cycle26': '{% load cycle from future %}{% cycle a b as ab %}{% cycle ab %}'})
def test_cycle26(self):
output = self.engine.render_to_string('cycle26', {'a': '<', 'b': '>'})
self.assertEqual(output, '&lt;&gt;')
@ignore_warnings(category=RemovedInDjango20Warning)
@ignore_warnings(category=RemovedInDjango110Warning)
@setup({'cycle27': '{% load cycle from future %}'
'{% autoescape off %}{% cycle a b as ab %}{% cycle ab %}{% endautoescape %}'})
def test_cycle27(self):
output = self.engine.render_to_string('cycle27', {'a': '<', 'b': '>'})
self.assertEqual(output, '<>')
@ignore_warnings(category=RemovedInDjango20Warning)
@ignore_warnings(category=RemovedInDjango110Warning)
@setup({'cycle28': '{% load cycle from future %}{% cycle a|safe b as ab %}{% cycle ab %}'})
def test_cycle28(self):
output = self.engine.render_to_string('cycle28', {'a': '<', 'b': '>'})

View file

@ -1,6 +1,6 @@
from django.template import TemplateSyntaxError
from django.test import SimpleTestCase, ignore_warnings
from django.utils.deprecation import RemovedInDjango20Warning
from django.utils.deprecation import RemovedInDjango110Warning
from ..utils import setup
@ -58,26 +58,26 @@ class FirstOfTagTests(SimpleTestCase):
output = self.engine.render_to_string('firstof10', {'a': '<'})
self.assertEqual(output, '&lt;')
@ignore_warnings(category=RemovedInDjango20Warning)
@ignore_warnings(category=RemovedInDjango110Warning)
@setup({'firstof11': '{% load firstof from future %}{% firstof a b %}'})
def test_firstof11(self):
output = self.engine.render_to_string('firstof11', {'a': '<', 'b': '>'})
self.assertEqual(output, '&lt;')
@ignore_warnings(category=RemovedInDjango20Warning)
@ignore_warnings(category=RemovedInDjango110Warning)
@setup({'firstof12': '{% load firstof from future %}{% firstof a b %}'})
def test_firstof12(self):
output = self.engine.render_to_string('firstof12', {'a': '', 'b': '>'})
self.assertEqual(output, '&gt;')
@ignore_warnings(category=RemovedInDjango20Warning)
@ignore_warnings(category=RemovedInDjango110Warning)
@setup({'firstof13': '{% load firstof from future %}'
'{% autoescape off %}{% firstof a %}{% endautoescape %}'})
def test_firstof13(self):
output = self.engine.render_to_string('firstof13', {'a': '<'})
self.assertEqual(output, '<')
@ignore_warnings(category=RemovedInDjango20Warning)
@ignore_warnings(category=RemovedInDjango110Warning)
@setup({'firstof14': '{% load firstof from future %}{% firstof a|safe b %}'})
def test_firstof14(self):
output = self.engine.render_to_string('firstof14', {'a': '<'})

View file

@ -1,6 +1,6 @@
from django.template import TemplateSyntaxError
from django.test import SimpleTestCase, ignore_warnings
from django.utils.deprecation import RemovedInDjango20Warning
from django.utils.deprecation import RemovedInDjango110Warning
from ..utils import setup
@ -126,9 +126,9 @@ class ForTagTests(SimpleTestCase):
self.assertEqual(output, 'abc')
# These tests raise deprecation warnings and will raise an exception
# in Django 2.0. The existing behavior is silent truncation if the
# in Django 1.10. The existing behavior is silent truncation if the
# length of loopvars differs to the length of each set of items.
@ignore_warnings(category=RemovedInDjango20Warning)
@ignore_warnings(category=RemovedInDjango110Warning)
@setup({'for-tag-unpack10': '{% for x,y in items %}{{ x }}:{{ y }}/{% endfor %}'})
def test_for_tag_unpack10(self):
output = self.engine.render_to_string(
@ -137,7 +137,7 @@ class ForTagTests(SimpleTestCase):
)
self.assertEqual(output, 'one:1/two:2/')
@ignore_warnings(category=RemovedInDjango20Warning)
@ignore_warnings(category=RemovedInDjango110Warning)
@setup({'for-tag-unpack11': '{% for x,y,z in items %}{{ x }}:{{ y }},{{ z }}/{% endfor %}'})
def test_for_tag_unpack11(self):
output = self.engine.render_to_string(
@ -150,7 +150,7 @@ class ForTagTests(SimpleTestCase):
else:
self.assertEqual(output, 'one:1,/two:2,/')
@ignore_warnings(category=RemovedInDjango20Warning)
@ignore_warnings(category=RemovedInDjango110Warning)
@setup({'for-tag-unpack12': '{% for x,y,z in items %}{{ x }}:{{ y }},{{ z }}/{% endfor %}'})
def test_for_tag_unpack12(self):
output = self.engine.render_to_string(
@ -162,7 +162,7 @@ class ForTagTests(SimpleTestCase):
else:
self.assertEqual(output, 'one:1,carrot/two:2,/')
@ignore_warnings(category=RemovedInDjango20Warning)
@ignore_warnings(category=RemovedInDjango110Warning)
@setup({'for-tag-unpack14': '{% for x,y in items %}{{ x }}:{{ y }}/{% endfor %}'})
def test_for_tag_unpack14(self):
output = self.engine.render_to_string('for-tag-unpack14', {'items': (1, 2)})

View file

@ -3,7 +3,7 @@ import warnings
from django.template import TemplateSyntaxError
from django.test import SimpleTestCase, ignore_warnings
from django.test.utils import reset_warning_registry
from django.utils.deprecation import RemovedInDjango20Warning
from django.utils.deprecation import RemovedInDjango110Warning
from ..utils import TestObj, setup
@ -537,15 +537,15 @@ class IfTagTests(SimpleTestCase):
self.assertEqual(len(warns), 1)
self.assertEqual(
str(warns[0].message),
"Operator '=' is deprecated and will be removed in Django 2.0. "
"Operator '=' is deprecated and will be removed in Django 1.10. "
"Use '==' instead."
)
@ignore_warnings(category=RemovedInDjango20Warning)
@ignore_warnings(category=RemovedInDjango110Warning)
class TestEqualitySingleEqualsSign(SimpleTestCase):
# The following tests should be changed to template.TemplateSyntaxError
# (or simply removed) when the deprecation path ends in Django 2.0.
# (or simply removed) when the deprecation path ends in Django 1.10.
@setup({'if-tag-eq01': '{% if foo = bar %}yes{% else %}no{% endif %}'})
def test_if_tag_eq01(self):
output = self.engine.render_to_string('if-tag-eq01', {'foo': 1})

View file

@ -4,12 +4,12 @@ import os
from django.template import Context, Engine
from django.test import SimpleTestCase, ignore_warnings
from django.utils.deprecation import RemovedInDjango20Warning
from django.utils.deprecation import RemovedInDjango110Warning
from ..utils import ROOT, setup
@ignore_warnings(category=RemovedInDjango20Warning)
@ignore_warnings(category=RemovedInDjango110Warning)
class SsiTagTests(SimpleTestCase):
# Test normal behavior
@ -81,7 +81,7 @@ class SsiTagTests(SimpleTestCase):
'with spaces in its name. Look ma! It parsed!\n')
@ignore_warnings(category=RemovedInDjango20Warning)
@ignore_warnings(category=RemovedInDjango110Warning)
class SSISecurityTests(SimpleTestCase):
def setUp(self):

View file

@ -2,7 +2,7 @@
from django.core.urlresolvers import NoReverseMatch
from django.template import TemplateSyntaxError
from django.test import SimpleTestCase, ignore_warnings, override_settings
from django.utils.deprecation import RemovedInDjango20Warning
from django.utils.deprecation import RemovedInDjango110Warning
from ..utils import setup
@ -11,37 +11,37 @@ from ..utils import setup
class UrlTagTests(SimpleTestCase):
# Successes
@ignore_warnings(category=RemovedInDjango20Warning)
@ignore_warnings(category=RemovedInDjango110Warning)
@setup({'url01': '{% url "template_tests.views.client" client.id %}'})
def test_url01(self):
output = self.engine.render_to_string('url01', {'client': {'id': 1}})
self.assertEqual(output, '/client/1/')
@ignore_warnings(category=RemovedInDjango20Warning)
@ignore_warnings(category=RemovedInDjango110Warning)
@setup({'url02': '{% url "template_tests.views.client_action" id=client.id action="update" %}'})
def test_url02(self):
output = self.engine.render_to_string('url02', {'client': {'id': 1}})
self.assertEqual(output, '/client/1/update/')
@ignore_warnings(category=RemovedInDjango20Warning)
@ignore_warnings(category=RemovedInDjango110Warning)
@setup({'url02a': '{% url "template_tests.views.client_action" client.id "update" %}'})
def test_url02a(self):
output = self.engine.render_to_string('url02a', {'client': {'id': 1}})
self.assertEqual(output, '/client/1/update/')
@ignore_warnings(category=RemovedInDjango20Warning)
@ignore_warnings(category=RemovedInDjango110Warning)
@setup({'url02b': "{% url 'template_tests.views.client_action' id=client.id action='update' %}"})
def test_url02b(self):
output = self.engine.render_to_string('url02b', {'client': {'id': 1}})
self.assertEqual(output, '/client/1/update/')
@ignore_warnings(category=RemovedInDjango20Warning)
@ignore_warnings(category=RemovedInDjango110Warning)
@setup({'url02c': "{% url 'template_tests.views.client_action' client.id 'update' %}"})
def test_url02c(self):
output = self.engine.render_to_string('url02c', {'client': {'id': 1}})
self.assertEqual(output, '/client/1/update/')
@ignore_warnings(category=RemovedInDjango20Warning)
@ignore_warnings(category=RemovedInDjango110Warning)
@setup({'url03': '{% url "template_tests.views.index" %}'})
def test_url03(self):
output = self.engine.render_to_string('url03')
@ -62,7 +62,7 @@ class UrlTagTests(SimpleTestCase):
output = self.engine.render_to_string('url06', {'v': 'Ω'})
self.assertEqual(output, '/%D0%AE%D0%BD%D0%B8%D0%BA%D0%BE%D0%B4/%CE%A9/')
@ignore_warnings(category=RemovedInDjango20Warning)
@ignore_warnings(category=RemovedInDjango110Warning)
@setup({'url07': '{% url "template_tests.views.client2" tag=v %}'})
def test_url07(self):
output = self.engine.render_to_string('url07', {'v': 'Ω'})
@ -78,13 +78,13 @@ class UrlTagTests(SimpleTestCase):
output = self.engine.render_to_string('url09', {'v': 'Ω'})
self.assertEqual(output, '/%D0%AE%D0%BD%D0%B8%D0%BA%D0%BE%D0%B4/%CE%A9/')
@ignore_warnings(category=RemovedInDjango20Warning)
@ignore_warnings(category=RemovedInDjango110Warning)
@setup({'url10': '{% url "template_tests.views.client_action" id=client.id action="two words" %}'})
def test_url10(self):
output = self.engine.render_to_string('url10', {'client': {'id': 1}})
self.assertEqual(output, '/client/1/two%20words/')
@ignore_warnings(category=RemovedInDjango20Warning)
@ignore_warnings(category=RemovedInDjango110Warning)
@setup({'url11': '{% url "template_tests.views.client_action" id=client.id action="==" %}'})
def test_url11(self):
output = self.engine.render_to_string('url11', {'client': {'id': 1}})
@ -92,37 +92,37 @@ class UrlTagTests(SimpleTestCase):
@setup({'url12': '{% url "template_tests.views.client_action" '
'id=client.id action="!$&\'()*+,;=~:@," %}'})
@ignore_warnings(category=RemovedInDjango20Warning)
@ignore_warnings(category=RemovedInDjango110Warning)
def test_url12(self):
output = self.engine.render_to_string('url12', {'client': {'id': 1}})
self.assertEqual(output, '/client/1/!$&\'()*+,;=~:@,/')
@ignore_warnings(category=RemovedInDjango20Warning)
@ignore_warnings(category=RemovedInDjango110Warning)
@setup({'url13': '{% url "template_tests.views.client_action" '
'id=client.id action=arg|join:"-" %}'})
def test_url13(self):
output = self.engine.render_to_string('url13', {'client': {'id': 1}, 'arg': ['a', 'b']})
self.assertEqual(output, '/client/1/a-b/')
@ignore_warnings(category=RemovedInDjango20Warning)
@ignore_warnings(category=RemovedInDjango110Warning)
@setup({'url14': '{% url "template_tests.views.client_action" client.id arg|join:"-" %}'})
def test_url14(self):
output = self.engine.render_to_string('url14', {'client': {'id': 1}, 'arg': ['a', 'b']})
self.assertEqual(output, '/client/1/a-b/')
@ignore_warnings(category=RemovedInDjango20Warning)
@ignore_warnings(category=RemovedInDjango110Warning)
@setup({'url15': '{% url "template_tests.views.client_action" 12 "test" %}'})
def test_url15(self):
output = self.engine.render_to_string('url15')
self.assertEqual(output, '/client/12/test/')
@ignore_warnings(category=RemovedInDjango20Warning)
@ignore_warnings(category=RemovedInDjango110Warning)
@setup({'url18': '{% url "template_tests.views.client" "1,2" %}'})
def test_url18(self):
output = self.engine.render_to_string('url18')
self.assertEqual(output, '/client/1,2/')
@ignore_warnings(category=RemovedInDjango20Warning)
@ignore_warnings(category=RemovedInDjango110Warning)
@setup({'url19': '{% url named_url client.id %}'})
def test_url19(self):
output = self.engine.render_to_string('url19', {'client': {'id': 1}, 'named_url': 'template_tests.views.client'})
@ -144,7 +144,7 @@ class UrlTagTests(SimpleTestCase):
with self.assertRaises(NoReverseMatch):
self.engine.render_to_string('url-fail02')
@ignore_warnings(category=RemovedInDjango20Warning)
@ignore_warnings(category=RemovedInDjango110Warning)
@setup({'url-fail03': '{% url "template_tests.views.client" %}'})
def test_url_fail03(self):
with self.assertRaises(NoReverseMatch):
@ -190,7 +190,7 @@ class UrlTagTests(SimpleTestCase):
with self.assertRaises(NoReverseMatch):
self.engine.render_to_string('url-fail12', {'named_url': 'no_such_view'})
@ignore_warnings(category=RemovedInDjango20Warning)
@ignore_warnings(category=RemovedInDjango110Warning)
@setup({'url-fail13': '{% url named_url %}'})
def test_url_fail13(self):
with self.assertRaises(NoReverseMatch):
@ -227,13 +227,13 @@ class UrlTagTests(SimpleTestCase):
self.engine.render_to_string('url-fail19', {'named_url': 'view'})
# {% url ... as var %}
@ignore_warnings(category=RemovedInDjango20Warning)
@ignore_warnings(category=RemovedInDjango110Warning)
@setup({'url-asvar01': '{% url "template_tests.views.index" as url %}'})
def test_url_asvar01(self):
output = self.engine.render_to_string('url-asvar01')
self.assertEqual(output, '')
@ignore_warnings(category=RemovedInDjango20Warning)
@ignore_warnings(category=RemovedInDjango110Warning)
@setup({'url-asvar02': '{% url "template_tests.views.index" as url %}{{ url }}'})
def test_url_asvar02(self):
output = self.engine.render_to_string('url-asvar02')