diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/i18n/other2/__init__.py | 0 | ||||
| -rw-r--r-- | tests/i18n/other2/locale/__init__.py | 0 | ||||
| -rw-r--r-- | tests/i18n/other2/locale/de/__init__.py | 0 | ||||
| -rw-r--r-- | tests/i18n/other2/locale/de/formats.py | 0 | ||||
| -rw-r--r-- | tests/i18n/tests.py | 24 |
5 files changed, 20 insertions, 4 deletions
diff --git a/tests/i18n/other2/__init__.py b/tests/i18n/other2/__init__.py new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/i18n/other2/__init__.py diff --git a/tests/i18n/other2/locale/__init__.py b/tests/i18n/other2/locale/__init__.py new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/i18n/other2/locale/__init__.py diff --git a/tests/i18n/other2/locale/de/__init__.py b/tests/i18n/other2/locale/de/__init__.py new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/i18n/other2/locale/de/__init__.py diff --git a/tests/i18n/other2/locale/de/formats.py b/tests/i18n/other2/locale/de/formats.py new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/i18n/other2/locale/de/formats.py diff --git a/tests/i18n/tests.py b/tests/i18n/tests.py index 8d0fc963af..d07c0d94a0 100644 --- a/tests/i18n/tests.py +++ b/tests/i18n/tests.py @@ -738,11 +738,27 @@ class FormattingTests(TestCase): """ Tests the iter_format_modules function. """ + # Importing some format modules so that we can compare the returned + # modules with these expected modules + default_mod = import_module('django.conf.locale.de.formats') + test_mod = import_module('i18n.other.locale.de.formats') + test_mod2 = import_module('i18n.other2.locale.de.formats') + 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]) - test_de_format_mod = import_module('i18n.other.locale.de.formats') - self.assertEqual(list(iter_format_modules('de', 'i18n.other.locale')), [test_de_format_mod, de_format_mod]) + # Should return the correct default module when no setting is set + self.assertEqual(list(iter_format_modules('de')), [default_mod]) + + # When the setting is a string, should return the given module and + # the default module + self.assertEqual( + list(iter_format_modules('de', 'i18n.other.locale')), + [test_mod, default_mod]) + + # When setting is a list of strings, should return the given + # modules and the default module + self.assertEqual( + list(iter_format_modules('de', ['i18n.other.locale', 'i18n.other2.locale'])), + [test_mod, test_mod2, default_mod]) def test_iter_format_modules_stability(self): """ |
