def test_iter_format_modules(self): """ Tests the iter_format_modules function. """ settings.USE_L10N = True with translation.override('de-at', deactivate=True): de_format_mod = import_module('django.conf.locale.de.formats') self.assertEqual(list(iter_format_modules('de')), [de_format_mod]) with self.settings(FORMAT_MODULE_PATH='regressiontests.i18n.other.locale'): test_de_format_mod = import_module('regressiontests.i18n.other.locale.de.formats') self.assertEqual(list(iter_format_modules('de')), [test_de_format_mod, de_format_mod])
def test_iter_format_modules(self): """ Tests the iter_format_modules function. """ activate("de-at") old_format_module_path = settings.FORMAT_MODULE_PATH try: settings.USE_L10N = True de_format_mod = import_module("django.conf.locale.de.formats") self.assertEqual(list(iter_format_modules("de")), [de_format_mod]) settings.FORMAT_MODULE_PATH = "regressiontests.i18n.other.locale" test_de_format_mod = import_module("regressiontests.i18n.other.locale.de.formats") self.assertEqual(list(iter_format_modules("de")), [test_de_format_mod, de_format_mod]) finally: settings.FORMAT_MODULE_PATH = old_format_module_path deactivate()
def test_iter_format_modules(self): """ Tests the iter_format_modules function. """ activate('de-at') old_format_module_path = settings.FORMAT_MODULE_PATH try: settings.USE_L10N = True de_format_mod = import_module('django.conf.locale.de.formats') self.assertEqual(list(iter_format_modules('de')), [de_format_mod]) settings.FORMAT_MODULE_PATH = 'regressiontests.i18n.other.locale' test_de_format_mod = import_module('regressiontests.i18n.other.locale.de.formats') self.assertEqual(list(iter_format_modules('de')), [test_de_format_mod, de_format_mod]) finally: settings.FORMAT_MODULE_PATH = old_format_module_path deactivate()
def test_iter_format_modules_stability(self): """ Tests the iter_format_modules function always yields format modules in a stable and correct order in presence of both base ll and ll_CC formats. """ settings.USE_L10N = True en_format_mod = import_module('django.conf.locale.en.formats') en_gb_format_mod = import_module('django.conf.locale.en_GB.formats') self.assertEqual(list(iter_format_modules('en-gb')), [en_gb_format_mod, en_format_mod])
def test_iter_format_modules_stability(self): """ Tests the iter_format_modules function always yields format modules in a stable and correct order in presence of both base ll and ll_CC formats. """ try: old_l10n, settings.USE_L10N = settings.USE_L10N, True en_format_mod = import_module("django.conf.locale.en.formats") en_gb_format_mod = import_module("django.conf.locale.en_GB.formats") self.assertEqual(list(iter_format_modules("en-gb")), [en_gb_format_mod, en_format_mod]) finally: settings.USE_L10N = old_l10n