|
@@ -1,8 +1,9 @@
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
|
from django.template import Context, Template
|
|
|
-from django.test import SimpleTestCase
|
|
|
+from django.test import SimpleTestCase, ignore_warnings
|
|
|
from django.utils import html, six, text
|
|
|
+from django.utils.deprecation import RemovedInDjango20Warning
|
|
|
from django.utils.encoding import force_bytes
|
|
|
from django.utils.functional import lazy, lazystr
|
|
|
from django.utils.safestring import (
|
|
@@ -62,11 +63,13 @@ class SafeStringTest(SimpleTestCase):
|
|
|
def test_mark_safe_lazy_result_implements_dunder_html(self):
|
|
|
self.assertEqual(mark_safe(lazystr('a&b')).__html__(), 'a&b')
|
|
|
|
|
|
+ @ignore_warnings(category=RemovedInDjango20Warning)
|
|
|
def test_mark_for_escaping(self):
|
|
|
s = mark_for_escaping('a&b')
|
|
|
self.assertRenderEqual('{{ s }}', 'a&b', s=s)
|
|
|
self.assertRenderEqual('{{ s }}', 'a&b', s=mark_for_escaping(s))
|
|
|
|
|
|
+ @ignore_warnings(category=RemovedInDjango20Warning)
|
|
|
def test_mark_for_escaping_object_implementing_dunder_html(self):
|
|
|
e = customescape('<a&b>')
|
|
|
s = mark_for_escaping(e)
|
|
@@ -75,6 +78,7 @@ class SafeStringTest(SimpleTestCase):
|
|
|
self.assertRenderEqual('{{ s }}', '<<a&b>>', s=s)
|
|
|
self.assertRenderEqual('{{ s|force_escape }}', '<a&b>', s=s)
|
|
|
|
|
|
+ @ignore_warnings(category=RemovedInDjango20Warning)
|
|
|
def test_mark_for_escaping_lazy(self):
|
|
|
s = lazystr('a&b')
|
|
|
b = lazybytes(b'a&b')
|
|
@@ -83,6 +87,7 @@ class SafeStringTest(SimpleTestCase):
|
|
|
self.assertIsInstance(mark_for_escaping(b), EscapeData)
|
|
|
self.assertRenderEqual('{% autoescape off %}{{ s }}{% endautoescape %}', 'a&b', s=mark_for_escaping(s))
|
|
|
|
|
|
+ @ignore_warnings(category=RemovedInDjango20Warning)
|
|
|
def test_mark_for_escaping_object_implementing_dunder_str(self):
|
|
|
class Obj(object):
|
|
|
def __str__(self):
|