summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/i18n/tests.py20
1 files changed, 19 insertions, 1 deletions
diff --git a/tests/i18n/tests.py b/tests/i18n/tests.py
index 3ffcb08d8b..64e6eb5eed 100644
--- a/tests/i18n/tests.py
+++ b/tests/i18n/tests.py
@@ -74,7 +74,6 @@ class TranslationTests(TestCase):
deactivate()
def test_override_decorator(self):
- activate('de')
@translation.override('pl')
def func_pl():
@@ -85,6 +84,7 @@ class TranslationTests(TestCase):
self.assertEqual(get_language(), settings.LANGUAGE_CODE)
try:
+ activate('de')
func_pl()
self.assertEqual(get_language(), 'de')
func_none()
@@ -92,6 +92,24 @@ class TranslationTests(TestCase):
finally:
deactivate()
+ def test_override_exit(self):
+ """
+ Test that the language restored is the one used when the function was
+ called, not the one used when the decorator was initialized. refs #23381
+ """
+ activate('fr')
+ @translation.override('pl')
+ def func_pl():
+ pass
+ deactivate()
+
+ try:
+ activate('en')
+ func_pl()
+ self.assertEqual(get_language(), 'en')
+ finally:
+ deactivate()
+
def test_lazy_objects(self):
"""
Format string interpolation should work with *_lazy objects.