Let's say we have a default language code in settings.py
LANGUAGE_CODE = 'en'
Then we have
>> from django.utils import translation
>> assert translation.get_language() == 'en'
We are good by now.
Then in a test, I would like to override the default language. Let's say I have
@override_settings(LANGUAGE_CODE='fr')
-- LANGUAGE_CODE = 'en'
Then we have
>> from django.utils import translation
>> assert translation.get_language() == 'en'
We are good by now.
Then in a test, I would like to override the default language. Let's say I have
@override_settings(LANGUAGE_CODE='fr')
class SomeTestCase(TestCase): def test_some_case(self):
self.assert(translation.get_language(), 'en') # it will pass
self.assert(translation.get_language(), 'fr') # it would fail
Is this a bug?
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/39d728d5-edc3-40c4-94e8-492ede132daf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment