MCPcopy
hub / github.com/django/django / test_override_decorator

Method test_override_decorator

tests/i18n/tests.py:193–209  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

191 deactivate()
192
193 def test_override_decorator(self):
194 @translation.override("pl")
195 def func_pl():
196 self.assertEqual(get_language(), "pl")
197
198 @translation.override(None)
199 def func_none():
200 self.assertIsNone(get_language())
201
202 try:
203 activate("de")
204 func_pl()
205 self.assertEqual(get_language(), "de")
206 func_none()
207 self.assertEqual(get_language(), "de")
208 finally:
209 deactivate()
210
211 def test_override_exit(self):
212 """

Callers

nothing calls this directly

Calls 3

activateFunction · 0.90
get_languageFunction · 0.90
deactivateFunction · 0.90

Tested by

no test coverage detected