summaryrefslogtreecommitdiff
path: root/tests/forms_tests
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2014-01-26 14:29:04 +0100
committerAymeric Augustin <aymeric.augustin@m4x.org>2014-01-27 22:01:22 +0100
commitb951a7fbc12045eff104940dafaec308a543ead2 (patch)
tree1dbf9095629c68f19110eaabe1824dc8e1c49593 /tests/forms_tests
parent3145ae06beed2f8c679db5d7a06907dd2a03d138 (diff)
Removed superfluous uses of TransRealMixin.
The translation.override context manager cleans up after itself. As a consequence this mixin isn't needed any more in many cases.
Diffstat (limited to 'tests/forms_tests')
-rw-r--r--tests/forms_tests/tests/test_regressions.py14
1 files changed, 6 insertions, 8 deletions
diff --git a/tests/forms_tests/tests/test_regressions.py b/tests/forms_tests/tests/test_regressions.py
index 39459aa472..b009e800e1 100644
--- a/tests/forms_tests/tests/test_regressions.py
+++ b/tests/forms_tests/tests/test_regressions.py
@@ -9,13 +9,13 @@ from django.forms import (
TextInput,
)
from django.test import TestCase
-from django.utils.translation import ugettext_lazy, override
+from django.utils import translation
+from django.utils.translation import gettext_lazy, ugettext_lazy
from forms_tests.models import Cheese
-from django.test.utils import TransRealMixin
-class FormsRegressionsTestCase(TransRealMixin, TestCase):
+class FormsRegressionsTestCase(TestCase):
def test_class(self):
# Tests to prevent against recurrences of earlier bugs.
extra_attrs = {'class': 'special'}
@@ -37,9 +37,9 @@ class FormsRegressionsTestCase(TransRealMixin, TestCase):
self.assertHTMLEqual(f.as_p(), '<p><label for="id_username">Username:</label> <input id="id_username" type="text" name="username" maxlength="10" /></p>')
# Translations are done at rendering time, so multi-lingual apps can define forms)
- with override('de'):
+ with translation.override('de'):
self.assertHTMLEqual(f.as_p(), '<p><label for="id_username">Benutzername:</label> <input id="id_username" type="text" name="username" maxlength="10" /></p>')
- with override('pl', deactivate=True):
+ with translation.override('pl'):
self.assertHTMLEqual(f.as_p(), '<p><label for="id_username">Nazwa u\u017cytkownika:</label> <input id="id_username" type="text" name="username" maxlength="10" /></p>')
def test_regression_5216(self):
@@ -73,13 +73,11 @@ class FormsRegressionsTestCase(TransRealMixin, TestCase):
self.assertEqual(f.clean(b'\xd1\x88\xd1\x82.'), '\u0448\u0442.')
# Translated error messages used to be buggy.
- with override('ru'):
+ with translation.override('ru'):
f = SomeForm({})
self.assertHTMLEqual(f.as_p(), '<ul class="errorlist"><li>\u041e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u043f\u043e\u043b\u0435.</li></ul>\n<p><label for="id_somechoice_0">\xc5\xf8\xdf:</label> <ul id="id_somechoice">\n<li><label for="id_somechoice_0"><input type="radio" id="id_somechoice_0" value="\xc5" name="somechoice" /> En tied\xe4</label></li>\n<li><label for="id_somechoice_1"><input type="radio" id="id_somechoice_1" value="\xf8" name="somechoice" /> Mies</label></li>\n<li><label for="id_somechoice_2"><input type="radio" id="id_somechoice_2" value="\xdf" name="somechoice" /> Nainen</label></li>\n</ul></p>')
# Deep copying translated text shouldn't raise an error)
- from django.utils.translation import gettext_lazy
-
class CopyForm(Form):
degree = IntegerField(widget=Select(choices=((1, gettext_lazy('test')),)))