Add test for custom date format

This commit is contained in:
Christopher C. Wells 2021-07-31 20:09:14 -07:00 committed by Christopher Charbonneau Wells
parent 94cb7d771a
commit 16c34ca7f0
2 changed files with 6 additions and 0 deletions

View File

@ -18,6 +18,7 @@ else:
'%m/%d/%Y %I:%M %p', # '10/25/2006 2:30 PM' '%m/%d/%Y %I:%M %p', # '10/25/2006 2:30 PM'
] ]
# Add custom "short" version of `MONTH_DAY_FORMAT`.
SHORT_MONTH_DAY_FORMAT = 'M j' SHORT_MONTH_DAY_FORMAT = 'M j'
# Append all other input formats from the base locale. # Append all other input formats from the base locale.

View File

@ -60,3 +60,8 @@ class FormatsTestCase(TestCase):
t = datetime.time(hour=16, minute=2, second=25) t = datetime.time(hour=16, minute=2, second=25)
self.assertEqual(time_format(t), '16:02:25') self.assertEqual(time_format(t), '16:02:25')
def test_short_month_day_format(self):
dt = datetime.datetime(year=2021, month=7, day=31, hour=5, minute=5,
second=5)
self.assertEqual(date_format(dt, 'SHORT_MONTH_DAY_FORMAT'), 'Jul 31')