summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2017-10-13 18:37:31 +0200
committerClaude Paroz <claude@2xlibre.net>2017-10-13 19:50:18 +0200
commit5595eccd4f21098f13640711420463d528b22560 (patch)
treec17346d52c199d7996a40ccc40d6dab43c69b490 /tests
parent73d025a04215a3738867fbe1f8b0ce6557a3ee03 (diff)
[2.0.x] Fixed #28710 -- Fixed the Basque DATE_FORMAT string
Thanks Eneko Illarramendi for the report and initial patch. Backport of 8c538871bda3832bca2dddefe317bf4a9230dd45 from master.
Diffstat (limited to 'tests')
-rw-r--r--tests/i18n/tests.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/i18n/tests.py b/tests/i18n/tests.py
index 449def5363..8f881e83c8 100644
--- a/tests/i18n/tests.py
+++ b/tests/i18n/tests.py
@@ -9,6 +9,7 @@ from threading import local
from django import forms
from django.conf import settings
+from django.conf.locale import LANG_INFO
from django.conf.urls.i18n import i18n_patterns
from django.template import Context, Template
from django.test import (
@@ -335,6 +336,23 @@ class FormattingTests(SimpleTestCase):
'l': self.long,
})
+ def test_all_format_strings(self):
+ all_locales = LANG_INFO.keys()
+ today = datetime.date.today()
+ now = datetime.datetime.now()
+ current_year = str(today.year)
+ current_day = str(today.day)
+ current_minute = str(now.minute)
+ for locale in all_locales:
+ with self.subTest(locale=locale), translation.override(locale):
+ self.assertIn(current_year, date_format(today)) # Uses DATE_FORMAT by default
+ self.assertIn(current_minute, time_format(now)) # Uses TIME_FORMAT by default
+ self.assertIn(current_year, date_format(now, format=get_format('DATETIME_FORMAT')))
+ self.assertIn(current_year, date_format(today, format=get_format('YEAR_MONTH_FORMAT')))
+ self.assertIn(current_day, date_format(today, format=get_format('MONTH_DAY_FORMAT')))
+ self.assertIn(current_year, date_format(today, format=get_format('SHORT_DATE_FORMAT')))
+ self.assertIn(current_year, date_format(now, format=get_format('SHORT_DATETIME_FORMAT')))
+
def test_locale_independent(self):
"""
Localization of numbers