mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Isolated template tests from Django settings.
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
# coding: utf-8
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.conf import settings
|
||||
from django.test import SimpleTestCase
|
||||
from django.utils import translation
|
||||
from django.utils.safestring import mark_safe
|
||||
|
||||
from ..utils import render, setup
|
||||
from ..utils import setup
|
||||
|
||||
|
||||
class I18nTagTests(SimpleTestCase):
|
||||
@@ -15,7 +15,7 @@ class I18nTagTests(SimpleTestCase):
|
||||
"""
|
||||
simple translation of a string delimited by '
|
||||
"""
|
||||
output = render('i18n01')
|
||||
output = self.engine.render_to_string('i18n01')
|
||||
self.assertEqual(output, 'xxxyyyxxx')
|
||||
|
||||
@setup({'i18n02': '{% load i18n %}{% trans "xxxyyyxxx" %}'})
|
||||
@@ -23,7 +23,7 @@ class I18nTagTests(SimpleTestCase):
|
||||
"""
|
||||
simple translation of a string delimited by "
|
||||
"""
|
||||
output = render('i18n02')
|
||||
output = self.engine.render_to_string('i18n02')
|
||||
self.assertEqual(output, 'xxxyyyxxx')
|
||||
|
||||
@setup({'i18n03': '{% load i18n %}{% blocktrans %}{{ anton }}{% endblocktrans %}'})
|
||||
@@ -31,7 +31,7 @@ class I18nTagTests(SimpleTestCase):
|
||||
"""
|
||||
simple translation of a variable
|
||||
"""
|
||||
output = render('i18n03', {'anton': b'\xc3\x85'})
|
||||
output = self.engine.render_to_string('i18n03', {'anton': b'\xc3\x85'})
|
||||
self.assertEqual(output, 'Å')
|
||||
|
||||
@setup({'i18n04': '{% load i18n %}{% blocktrans with berta=anton|lower %}{{ berta }}{% endblocktrans %}'})
|
||||
@@ -39,7 +39,7 @@ class I18nTagTests(SimpleTestCase):
|
||||
"""
|
||||
simple translation of a variable and filter
|
||||
"""
|
||||
output = render('i18n04', {'anton': b'\xc3\x85'})
|
||||
output = self.engine.render_to_string('i18n04', {'anton': b'\xc3\x85'})
|
||||
self.assertEqual(output, 'å')
|
||||
|
||||
@setup({'legacyi18n04': '{% load i18n %}'
|
||||
@@ -48,7 +48,7 @@ class I18nTagTests(SimpleTestCase):
|
||||
"""
|
||||
simple translation of a variable and filter
|
||||
"""
|
||||
output = render('legacyi18n04', {'anton': b'\xc3\x85'})
|
||||
output = self.engine.render_to_string('legacyi18n04', {'anton': b'\xc3\x85'})
|
||||
self.assertEqual(output, 'å')
|
||||
|
||||
@setup({'i18n05': '{% load i18n %}{% blocktrans %}xxx{{ anton }}xxx{% endblocktrans %}'})
|
||||
@@ -56,7 +56,7 @@ class I18nTagTests(SimpleTestCase):
|
||||
"""
|
||||
simple translation of a string with interpolation
|
||||
"""
|
||||
output = render('i18n05', {'anton': 'yyy'})
|
||||
output = self.engine.render_to_string('i18n05', {'anton': 'yyy'})
|
||||
self.assertEqual(output, 'xxxyyyxxx')
|
||||
|
||||
@setup({'i18n06': '{% load i18n %}{% trans "Page not found" %}'})
|
||||
@@ -64,7 +64,8 @@ class I18nTagTests(SimpleTestCase):
|
||||
"""
|
||||
simple translation of a string to german
|
||||
"""
|
||||
output = render('i18n06', {'LANGUAGE_CODE': 'de'})
|
||||
with translation.override('de'):
|
||||
output = self.engine.render_to_string('i18n06')
|
||||
self.assertEqual(output, 'Seite nicht gefunden')
|
||||
|
||||
@setup({'i18n07': '{% load i18n %}'
|
||||
@@ -74,7 +75,7 @@ class I18nTagTests(SimpleTestCase):
|
||||
"""
|
||||
translation of singular form
|
||||
"""
|
||||
output = render('i18n07', {'number': 1})
|
||||
output = self.engine.render_to_string('i18n07', {'number': 1})
|
||||
self.assertEqual(output, 'singular')
|
||||
|
||||
@setup({'legacyi18n07': '{% load i18n %}'
|
||||
@@ -84,7 +85,7 @@ class I18nTagTests(SimpleTestCase):
|
||||
"""
|
||||
translation of singular form
|
||||
"""
|
||||
output = render('legacyi18n07', {'number': 1})
|
||||
output = self.engine.render_to_string('legacyi18n07', {'number': 1})
|
||||
self.assertEqual(output, 'singular')
|
||||
|
||||
@setup({'i18n08': '{% load i18n %}'
|
||||
@@ -94,7 +95,7 @@ class I18nTagTests(SimpleTestCase):
|
||||
"""
|
||||
translation of plural form
|
||||
"""
|
||||
output = render('i18n08', {'number': 2})
|
||||
output = self.engine.render_to_string('i18n08', {'number': 2})
|
||||
self.assertEqual(output, '2 plural')
|
||||
|
||||
@setup({'legacyi18n08': '{% load i18n %}'
|
||||
@@ -104,7 +105,7 @@ class I18nTagTests(SimpleTestCase):
|
||||
"""
|
||||
translation of plural form
|
||||
"""
|
||||
output = render('legacyi18n08', {'number': 2})
|
||||
output = self.engine.render_to_string('legacyi18n08', {'number': 2})
|
||||
self.assertEqual(output, '2 plural')
|
||||
|
||||
@setup({'i18n09': '{% load i18n %}{% trans "Page not found" noop %}'})
|
||||
@@ -112,7 +113,8 @@ class I18nTagTests(SimpleTestCase):
|
||||
"""
|
||||
simple non-translation (only marking) of a string to german
|
||||
"""
|
||||
output = render('i18n09', {'LANGUAGE_CODE': 'de'})
|
||||
with translation.override('de'):
|
||||
output = self.engine.render_to_string('i18n09')
|
||||
self.assertEqual(output, 'Page not found')
|
||||
|
||||
@setup({'i18n10': '{{ bool|yesno:_("yes,no,maybe") }}'})
|
||||
@@ -120,7 +122,8 @@ class I18nTagTests(SimpleTestCase):
|
||||
"""
|
||||
translation of a variable with a translated filter
|
||||
"""
|
||||
output = render('i18n10', {'bool': True, 'LANGUAGE_CODE': 'de'})
|
||||
with translation.override('de'):
|
||||
output = self.engine.render_to_string('i18n10', {'bool': True})
|
||||
self.assertEqual(output, 'Ja')
|
||||
|
||||
@setup({'i18n11': '{{ bool|yesno:"ja,nein" }}'})
|
||||
@@ -128,7 +131,7 @@ class I18nTagTests(SimpleTestCase):
|
||||
"""
|
||||
translation of a variable with a non-translated filter
|
||||
"""
|
||||
output = render('i18n11', {'bool': True})
|
||||
output = self.engine.render_to_string('i18n11', {'bool': True})
|
||||
self.assertEqual(output, 'ja')
|
||||
|
||||
@setup({'i18n12': '{% load i18n %}'
|
||||
@@ -138,7 +141,7 @@ class I18nTagTests(SimpleTestCase):
|
||||
"""
|
||||
usage of the get_available_languages tag
|
||||
"""
|
||||
output = render('i18n12')
|
||||
output = self.engine.render_to_string('i18n12')
|
||||
self.assertEqual(output, 'de')
|
||||
|
||||
@setup({'i18n13': '{{ _("Password") }}'})
|
||||
@@ -146,7 +149,8 @@ class I18nTagTests(SimpleTestCase):
|
||||
"""
|
||||
translation of constant strings
|
||||
"""
|
||||
output = render('i18n13', {'LANGUAGE_CODE': 'de'})
|
||||
with translation.override('de'):
|
||||
output = self.engine.render_to_string('i18n13')
|
||||
self.assertEqual(output, 'Passwort')
|
||||
|
||||
@setup({'i18n14': '{% cycle "foo" _("Password") _(\'Password\') as c %} {% cycle c %} {% cycle c %}'})
|
||||
@@ -154,7 +158,8 @@ class I18nTagTests(SimpleTestCase):
|
||||
"""
|
||||
translation of constant strings
|
||||
"""
|
||||
output = render('i18n14', {'LANGUAGE_CODE': 'de'})
|
||||
with translation.override('de'):
|
||||
output = self.engine.render_to_string('i18n14')
|
||||
self.assertEqual(output, 'foo Passwort Passwort')
|
||||
|
||||
@setup({'i18n15': '{{ absent|default:_("Password") }}'})
|
||||
@@ -162,7 +167,8 @@ class I18nTagTests(SimpleTestCase):
|
||||
"""
|
||||
translation of constant strings
|
||||
"""
|
||||
output = render('i18n15', {'absent': '', 'LANGUAGE_CODE': 'de'})
|
||||
with translation.override('de'):
|
||||
output = self.engine.render_to_string('i18n15', {'absent': ''})
|
||||
self.assertEqual(output, 'Passwort')
|
||||
|
||||
@setup({'i18n16': '{{ _("<") }}'})
|
||||
@@ -170,7 +176,8 @@ class I18nTagTests(SimpleTestCase):
|
||||
"""
|
||||
translation of constant strings
|
||||
"""
|
||||
output = render('i18n16', {'LANGUAGE_CODE': 'de'})
|
||||
with translation.override('de'):
|
||||
output = self.engine.render_to_string('i18n16')
|
||||
self.assertEqual(output, '<')
|
||||
|
||||
@setup({'i18n17': '{% load i18n %}'
|
||||
@@ -179,46 +186,46 @@ class I18nTagTests(SimpleTestCase):
|
||||
"""
|
||||
Escaping inside blocktrans and trans works as if it was directly in the template.
|
||||
"""
|
||||
output = render('i18n17', {'anton': 'α & β'})
|
||||
output = self.engine.render_to_string('i18n17', {'anton': 'α & β'})
|
||||
self.assertEqual(output, 'α & β')
|
||||
|
||||
@setup({'i18n18': '{% load i18n %}'
|
||||
'{% blocktrans with berta=anton|force_escape %}{{ berta }}{% endblocktrans %}'})
|
||||
def test_i18n18(self):
|
||||
output = render('i18n18', {'anton': 'α & β'})
|
||||
output = self.engine.render_to_string('i18n18', {'anton': 'α & β'})
|
||||
self.assertEqual(output, 'α & β')
|
||||
|
||||
@setup({'i18n19': '{% load i18n %}{% blocktrans %}{{ andrew }}{% endblocktrans %}'})
|
||||
def test_i18n19(self):
|
||||
output = render('i18n19', {'andrew': 'a & b'})
|
||||
output = self.engine.render_to_string('i18n19', {'andrew': 'a & b'})
|
||||
self.assertEqual(output, 'a & b')
|
||||
|
||||
@setup({'i18n20': '{% load i18n %}{% trans andrew %}'})
|
||||
def test_i18n20(self):
|
||||
output = render('i18n20', {'andrew': 'a & b'})
|
||||
output = self.engine.render_to_string('i18n20', {'andrew': 'a & b'})
|
||||
self.assertEqual(output, 'a & b')
|
||||
|
||||
@setup({'i18n21': '{% load i18n %}{% blocktrans %}{{ andrew }}{% endblocktrans %}'})
|
||||
def test_i18n21(self):
|
||||
output = render('i18n21', {'andrew': mark_safe('a & b')})
|
||||
output = self.engine.render_to_string('i18n21', {'andrew': mark_safe('a & b')})
|
||||
self.assertEqual(output, 'a & b')
|
||||
|
||||
@setup({'i18n22': '{% load i18n %}{% trans andrew %}'})
|
||||
def test_i18n22(self):
|
||||
output = render('i18n22', {'andrew': mark_safe('a & b')})
|
||||
output = self.engine.render_to_string('i18n22', {'andrew': mark_safe('a & b')})
|
||||
self.assertEqual(output, 'a & b')
|
||||
|
||||
@setup({'legacyi18n17': '{% load i18n %}'
|
||||
'{% blocktrans with anton|escape as berta %}{{ berta }}{% endblocktrans %}'})
|
||||
def test_legacyi18n17(self):
|
||||
output = render('legacyi18n17', {'anton': 'α & β'})
|
||||
output = self.engine.render_to_string('legacyi18n17', {'anton': 'α & β'})
|
||||
self.assertEqual(output, 'α & β')
|
||||
|
||||
@setup({'legacyi18n18': '{% load i18n %}'
|
||||
'{% blocktrans with anton|force_escape as berta %}'
|
||||
'{{ berta }}{% endblocktrans %}'})
|
||||
def test_legacyi18n18(self):
|
||||
output = render('legacyi18n18', {'anton': 'α & β'})
|
||||
output = self.engine.render_to_string('legacyi18n18', {'anton': 'α & β'})
|
||||
self.assertEqual(output, 'α & β')
|
||||
|
||||
@setup({'i18n23': '{% load i18n %}{% trans "Page not found"|capfirst|slice:"6:" %}'})
|
||||
@@ -226,17 +233,20 @@ class I18nTagTests(SimpleTestCase):
|
||||
"""
|
||||
#5972 - Use filters with the {% trans %} tag
|
||||
"""
|
||||
output = render('i18n23', {'LANGUAGE_CODE': 'de'})
|
||||
with translation.override('de'):
|
||||
output = self.engine.render_to_string('i18n23')
|
||||
self.assertEqual(output, 'nicht gefunden')
|
||||
|
||||
@setup({'i18n24': '{% load i18n %}{% trans \'Page not found\'|upper %}'})
|
||||
def test_i18n24(self):
|
||||
output = render('i18n24', {'LANGUAGE_CODE': 'de'})
|
||||
with translation.override('de'):
|
||||
output = self.engine.render_to_string('i18n24')
|
||||
self.assertEqual(output, 'SEITE NICHT GEFUNDEN')
|
||||
|
||||
@setup({'i18n25': '{% load i18n %}{% trans somevar|upper %}'})
|
||||
def test_i18n25(self):
|
||||
output = render('i18n25', {'somevar': 'Page not found', 'LANGUAGE_CODE': 'de'})
|
||||
with translation.override('de'):
|
||||
output = self.engine.render_to_string('i18n25', {'somevar': 'Page not found'})
|
||||
self.assertEqual(output, 'SEITE NICHT GEFUNDEN')
|
||||
|
||||
@setup({'i18n26': '{% load i18n %}'
|
||||
@@ -246,14 +256,14 @@ class I18nTagTests(SimpleTestCase):
|
||||
"""
|
||||
translation of plural form with extra field in singular form (#13568)
|
||||
"""
|
||||
output = render('i18n26', {'myextra_field': 'test', 'number': 1})
|
||||
output = self.engine.render_to_string('i18n26', {'myextra_field': 'test', 'number': 1})
|
||||
self.assertEqual(output, 'singular test')
|
||||
|
||||
@setup({'legacyi18n26': '{% load i18n %}'
|
||||
'{% blocktrans with myextra_field as extra_field count number as counter %}'
|
||||
'singular {{ extra_field }}{% plural %}plural{% endblocktrans %}'})
|
||||
def test_legacyi18n26(self):
|
||||
output = render('legacyi18n26', {'myextra_field': 'test', 'number': 1})
|
||||
output = self.engine.render_to_string('legacyi18n26', {'myextra_field': 'test', 'number': 1})
|
||||
self.assertEqual(output, 'singular test')
|
||||
|
||||
@setup({'i18n27': '{% load i18n %}{% blocktrans count counter=number %}'
|
||||
@@ -263,14 +273,16 @@ class I18nTagTests(SimpleTestCase):
|
||||
"""
|
||||
translation of singular form in russian (#14126)
|
||||
"""
|
||||
output = render('i18n27', {'number': 1, 'LANGUAGE_CODE': 'ru'})
|
||||
with translation.override('ru'):
|
||||
output = self.engine.render_to_string('i18n27', {'number': 1})
|
||||
self.assertEqual(output, '1 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442')
|
||||
|
||||
@setup({'legacyi18n27': '{% load i18n %}'
|
||||
'{% blocktrans count number as counter %}{{ counter }} result'
|
||||
'{% plural %}{{ counter }} results{% endblocktrans %}'})
|
||||
def test_legacyi18n27(self):
|
||||
output = render('legacyi18n27', {'number': 1, 'LANGUAGE_CODE': 'ru'})
|
||||
with translation.override('ru'):
|
||||
output = self.engine.render_to_string('legacyi18n27', {'number': 1})
|
||||
self.assertEqual(output, '1 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442')
|
||||
|
||||
@setup({'i18n28': '{% load i18n %}'
|
||||
@@ -279,14 +291,14 @@ class I18nTagTests(SimpleTestCase):
|
||||
"""
|
||||
simple translation of multiple variables
|
||||
"""
|
||||
output = render('i18n28', {'anton': 'α', 'berta': 'β'})
|
||||
output = self.engine.render_to_string('i18n28', {'anton': 'α', 'berta': 'β'})
|
||||
self.assertEqual(output, 'α + β')
|
||||
|
||||
@setup({'legacyi18n28': '{% load i18n %}'
|
||||
'{% blocktrans with anton as a and berta as b %}'
|
||||
'{{ a }} + {{ b }}{% endblocktrans %}'})
|
||||
def test_legacyi18n28(self):
|
||||
output = render('legacyi18n28', {'anton': 'α', 'berta': 'β'})
|
||||
output = self.engine.render_to_string('legacyi18n28', {'anton': 'α', 'berta': 'β'})
|
||||
self.assertEqual(output, 'α + β')
|
||||
|
||||
# retrieving language information
|
||||
@@ -294,14 +306,14 @@ class I18nTagTests(SimpleTestCase):
|
||||
'{% get_language_info for "de" as l %}'
|
||||
'{{ l.code }}: {{ l.name }}/{{ l.name_local }} bidi={{ l.bidi }}'})
|
||||
def test_i18n28_2(self):
|
||||
output = render('i18n28_2')
|
||||
output = self.engine.render_to_string('i18n28_2')
|
||||
self.assertEqual(output, 'de: German/Deutsch bidi=False')
|
||||
|
||||
@setup({'i18n29': '{% load i18n %}'
|
||||
'{% get_language_info for LANGUAGE_CODE as l %}'
|
||||
'{{ l.code }}: {{ l.name }}/{{ l.name_local }} bidi={{ l.bidi }}'})
|
||||
def test_i18n29(self):
|
||||
output = render('i18n29', {'LANGUAGE_CODE': 'fi'})
|
||||
output = self.engine.render_to_string('i18n29', {'LANGUAGE_CODE': 'fi'})
|
||||
self.assertEqual(output, 'fi: Finnish/suomi bidi=False')
|
||||
|
||||
@setup({'i18n30': '{% load i18n %}'
|
||||
@@ -309,7 +321,7 @@ class I18nTagTests(SimpleTestCase):
|
||||
'{% for l in langs %}{{ l.code }}: {{ l.name }}/'
|
||||
'{{ l.name_local }} bidi={{ l.bidi }}; {% endfor %}'})
|
||||
def test_i18n30(self):
|
||||
output = render('i18n30', {'langcodes': ['it', 'no']})
|
||||
output = self.engine.render_to_string('i18n30', {'langcodes': ['it', 'no']})
|
||||
self.assertEqual(output, 'it: Italian/italiano bidi=False; no: Norwegian/norsk bidi=False; ')
|
||||
|
||||
@setup({'i18n31': '{% load i18n %}'
|
||||
@@ -317,7 +329,7 @@ class I18nTagTests(SimpleTestCase):
|
||||
'{% for l in langs %}{{ l.code }}: {{ l.name }}/'
|
||||
'{{ l.name_local }} bidi={{ l.bidi }}; {% endfor %}'})
|
||||
def test_i18n31(self):
|
||||
output = render('i18n31', {'langcodes': (('sl', 'Slovenian'), ('fa', 'Persian'))})
|
||||
output = self.engine.render_to_string('i18n31', {'langcodes': (('sl', 'Slovenian'), ('fa', 'Persian'))})
|
||||
self.assertEqual(
|
||||
output,
|
||||
'sl: Slovenian/Sloven\u0161\u010dina bidi=False; '
|
||||
@@ -327,38 +339,38 @@ class I18nTagTests(SimpleTestCase):
|
||||
@setup({'i18n32': '{% load i18n %}{{ "hu"|language_name }} '
|
||||
'{{ "hu"|language_name_local }} {{ "hu"|language_bidi }}'})
|
||||
def test_i18n32(self):
|
||||
output = render('i18n32')
|
||||
output = self.engine.render_to_string('i18n32')
|
||||
self.assertEqual(output, 'Hungarian Magyar False')
|
||||
|
||||
@setup({'i18n33': '{% load i18n %}'
|
||||
'{{ langcode|language_name }} {{ langcode|language_name_local }} '
|
||||
'{{ langcode|language_bidi }}'})
|
||||
def test_i18n33(self):
|
||||
output = render('i18n33', {'langcode': 'nl'})
|
||||
output = self.engine.render_to_string('i18n33', {'langcode': 'nl'})
|
||||
self.assertEqual(output, 'Dutch Nederlands False')
|
||||
|
||||
# blocktrans handling of variables which are not in the context.
|
||||
# this should work as if blocktrans was not there (#19915)
|
||||
@setup({'i18n34': '{% load i18n %}{% blocktrans %}{{ missing }}{% endblocktrans %}'})
|
||||
def test_i18n34(self):
|
||||
output = render('i18n34')
|
||||
if settings.TEMPLATE_STRING_IF_INVALID:
|
||||
output = self.engine.render_to_string('i18n34')
|
||||
if self.engine.string_if_invalid:
|
||||
self.assertEqual(output, 'INVALID')
|
||||
else:
|
||||
self.assertEqual(output, '')
|
||||
|
||||
@setup({'i18n34_2': '{% load i18n %}{% blocktrans with a=\'α\' %}{{ missing }}{% endblocktrans %}'})
|
||||
def test_i18n34_2(self):
|
||||
output = render('i18n34_2')
|
||||
if settings.TEMPLATE_STRING_IF_INVALID:
|
||||
output = self.engine.render_to_string('i18n34_2')
|
||||
if self.engine.string_if_invalid:
|
||||
self.assertEqual(output, 'INVALID')
|
||||
else:
|
||||
self.assertEqual(output, '')
|
||||
|
||||
@setup({'i18n34_3': '{% load i18n %}{% blocktrans with a=anton %}{{ missing }}{% endblocktrans %}'})
|
||||
def test_i18n34_3(self):
|
||||
output = render('i18n34_3', {'anton': '\xce\xb1'})
|
||||
if settings.TEMPLATE_STRING_IF_INVALID:
|
||||
output = self.engine.render_to_string('i18n34_3', {'anton': '\xce\xb1'})
|
||||
if self.engine.string_if_invalid:
|
||||
self.assertEqual(output, 'INVALID')
|
||||
else:
|
||||
self.assertEqual(output, '')
|
||||
@@ -366,20 +378,23 @@ class I18nTagTests(SimpleTestCase):
|
||||
# trans tag with as var
|
||||
@setup({'i18n35': '{% load i18n %}{% trans "Page not found" as page_not_found %}{{ page_not_found }}'})
|
||||
def test_i18n35(self):
|
||||
output = render('i18n35', {'LANGUAGE_CODE': 'de'})
|
||||
with translation.override('de'):
|
||||
output = self.engine.render_to_string('i18n35')
|
||||
self.assertEqual(output, 'Seite nicht gefunden')
|
||||
|
||||
@setup({'i18n36': '{% load i18n %}'
|
||||
'{% trans "Page not found" noop as page_not_found %}{{ page_not_found }}'})
|
||||
def test_i18n36(self):
|
||||
output = render('i18n36', {'LANGUAGE_CODE': 'de'})
|
||||
with translation.override('de'):
|
||||
output = self.engine.render_to_string('i18n36')
|
||||
self.assertEqual(output, 'Page not found')
|
||||
|
||||
@setup({'i18n37': '{% load i18n %}'
|
||||
'{% trans "Page not found" as page_not_found %}'
|
||||
'{% blocktrans %}Error: {{ page_not_found }}{% endblocktrans %}'})
|
||||
def test_i18n37(self):
|
||||
output = render('i18n37', {'LANGUAGE_CODE': 'de'})
|
||||
with translation.override('de'):
|
||||
output = self.engine.render_to_string('i18n37')
|
||||
self.assertEqual(output, 'Error: Seite nicht gefunden')
|
||||
|
||||
# Test whitespace in filter arguments
|
||||
@@ -387,7 +402,7 @@ class I18nTagTests(SimpleTestCase):
|
||||
'{% get_language_info for "de"|noop:"x y" as l %}'
|
||||
'{{ l.code }}: {{ l.name }}/{{ l.name_local }} bidi={{ l.bidi }}'})
|
||||
def test_i18n38(self):
|
||||
output = render('i18n38')
|
||||
output = self.engine.render_to_string('i18n38')
|
||||
self.assertEqual(output, 'de: German/Deutsch bidi=False')
|
||||
|
||||
@setup({'i18n38_2': '{% load i18n custom %}'
|
||||
@@ -395,5 +410,5 @@ class I18nTagTests(SimpleTestCase):
|
||||
'{% for l in langs %}{{ l.code }}: {{ l.name }}/'
|
||||
'{{ l.name_local }} bidi={{ l.bidi }}; {% endfor %}'})
|
||||
def test_i18n38_2(self):
|
||||
output = render('i18n38_2', {'langcodes': ['it', 'no']})
|
||||
output = self.engine.render_to_string('i18n38_2', {'langcodes': ['it', 'no']})
|
||||
self.assertEqual(output, 'it: Italian/italiano bidi=False; no: Norwegian/norsk bidi=False; ')
|
||||
|
||||
Reference in New Issue
Block a user