Fixed #32149 -- Added support for years < 1000 to DateFormat.y().

This commit is contained in:
Sam 2020-10-27 11:12:14 +07:00 committed by Mariusz Felisiak
parent c448e614c6
commit 895f6e4992
3 changed files with 16 additions and 3 deletions

View file

@ -165,3 +165,16 @@ class DateFormatTests(SimpleTestCase):
dateformat.format(dt, 'r'),
'Sun, 08 Jul 1979 22:00:00 +0100',
)
def test_year_before_1000(self):
tests = [
(476, '76'),
(42, '42'),
(4, '04'),
]
for year, expected_date in tests:
with self.subTest(year=year):
self.assertEqual(
dateformat.format(datetime(year, 9, 8, 5, 0), 'y'),
expected_date,
)