summaryrefslogtreecommitdiff
path: root/tests/utils_tests/test_dateformat.py
diff options
context:
space:
mode:
authorBaptiste Mispelon <bmispelon@gmail.com>2019-11-21 20:34:58 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2019-11-22 12:41:53 +0100
commit8929afb8ec4bc2bfb95b66c05fc3ab39e3748d91 (patch)
treebab999ca075bfa3682a6aeac0b6a736848e7c022 /tests/utils_tests/test_dateformat.py
parent76ec032712d28dd8d4b9ad425f2b330a3e9a9109 (diff)
Fixed #9762 -- Made DateFormat.r() locale-independent.
Thanks to Antonio Melé for the original report all those years ago and to all the contributors who helped along the way.
Diffstat (limited to 'tests/utils_tests/test_dateformat.py')
-rw-r--r--tests/utils_tests/test_dateformat.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/tests/utils_tests/test_dateformat.py b/tests/utils_tests/test_dateformat.py
index a77395cbf3..d050ac4352 100644
--- a/tests/utils_tests/test_dateformat.py
+++ b/tests/utils_tests/test_dateformat.py
@@ -131,7 +131,7 @@ class DateFormatTests(SimpleTestCase):
if TZ_SUPPORT:
self.assertEqual(dateformat.format(my_birthday, 'O'), '+0100')
- self.assertEqual(dateformat.format(my_birthday, 'r'), 'Sun, 8 Jul 1979 22:00:00 +0100')
+ self.assertEqual(dateformat.format(my_birthday, 'r'), 'Sun, 08 Jul 1979 22:00:00 +0100')
self.assertEqual(dateformat.format(my_birthday, 'T'), 'CET')
self.assertEqual(dateformat.format(my_birthday, 'e'), '')
self.assertEqual(dateformat.format(aware_dt, 'e'), '-0330')
@@ -156,3 +156,12 @@ class DateFormatTests(SimpleTestCase):
)
with self.assertRaisesMessage(TypeError, msg):
dateformat.format(my_birthday, specifier)
+
+ def test_r_format_with_non_en_locale(self):
+ # Changing the locale doesn't change the "r" format.
+ dt = datetime(1979, 7, 8, 22, 00)
+ with translation.override('fr'):
+ self.assertEqual(
+ dateformat.format(dt, 'r'),
+ 'Sun, 08 Jul 1979 22:00:00 +0100',
+ )