blob: ae30094d69ac3d5dac1b44b806a0315332faf5c2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
from django.template.defaultfilters import lower
from django.test import SimpleTestCase
from django.utils.safestring import mark_safe
from ..utils import setup
class LowerTests(SimpleTestCase):
@setup(
{
"lower01": (
"{% autoescape off %}{{ a|lower }} {{ b|lower }}{% endautoescape %}"
)
}
)
def test_lower01(self):
output = self.engine.render_to_string(
"lower01", {"a": "Apple & banana", "b": mark_safe("Apple & banana")}
)
self.assertEqual(output, "apple & banana apple & banana")
@setup({"lower02": "{{ a|lower }} {{ b|lower }}"})
def test_lower02(self):
output = self.engine.render_to_string(
"lower02", {"a": "Apple & banana", "b": mark_safe("Apple & banana")}
)
self.assertEqual(output, "apple & banana apple & banana")
class FunctionTests(SimpleTestCase):
def test_lower(self):
self.assertEqual(lower("TEST"), "test")
def test_unicode(self):
# uppercase E umlaut
self.assertEqual(lower("\xcb"), "\xeb")
def test_non_string_input(self):
self.assertEqual(lower(123), "123")
|