diff options
| author | Manatsawin Hanmongkolchai <manatsawin@gmail.com> | 2018-02-11 04:05:41 +0700 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2018-02-10 16:06:03 -0500 |
| commit | a1286b5a64bc56c3e33e53ffac0eefce76f3efdb (patch) | |
| tree | c486f095c4f9b1211f04542e0b0b57c315379065 /tests | |
| parent | 7b20d01a84ad5ac2da9b0604a736cbe174e900e0 (diff) | |
[2.0.x] Fixed #29109 -- Fixed the admin time picker widget for the Thai locale.
Backport of 1a1264f1494976c562c7cb832fe47f3e1e765b8f from master
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/i18n/tests.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/i18n/tests.py b/tests/i18n/tests.py index 83e2260a51..4e35391a83 100644 --- a/tests/i18n/tests.py +++ b/tests/i18n/tests.py @@ -3,6 +3,7 @@ import decimal import gettext as gettext_module import os import pickle +import re from contextlib import contextmanager from importlib import import_module from threading import local @@ -1091,6 +1092,22 @@ class FormattingTests(SimpleTestCase): with translation.override('fr', deactivate=True): self.assertEqual('d/m/Y CUSTOM', get_format('CUSTOM_DAY_FORMAT')) + def test_admin_javascript_supported_input_formats(self): + """ + The first input format for DATE_INPUT_FORMATS, TIME_INPUT_FORMATS, and + DATETIME_INPUT_FORMATS must not contain %f since that's unsupported by + the admin's time picker widget. + """ + regex = re.compile('%([^BcdHImMpSwxXyY%])') + for language_code, language_name in settings.LANGUAGES: + for format_name in ('DATE_INPUT_FORMATS', 'TIME_INPUT_FORMATS', 'DATETIME_INPUT_FORMATS'): + with self.subTest(language=language_code, format=format_name): + formatter = get_format(format_name, lang=language_code)[0] + self.assertEqual( + regex.findall(formatter), [], + "%s locale's %s uses an unsupported format code." % (language_code, format_name) + ) + class MiscTests(SimpleTestCase): |
