Refs #29600 -- Added test for datetime_safe usage in SelectDateWidget.value_from_datadict().

This commit is contained in:
Tim Graham 2018-07-26 16:22:17 -04:00
parent 2ac7cd52b4
commit 76852c3989
1 changed files with 6 additions and 0 deletions

View File

@ -477,6 +477,12 @@ class SelectDateWidgetTest(WidgetTest):
w.value_from_datadict({'date_year': '1899', 'date_month': '8', 'date_day': '13'}, {}, 'date'),
'13-08-1899',
)
# And years before 1000 (demonstrating the need for datetime_safe).
w = SelectDateWidget(years=('0001',))
self.assertEqual(
w.value_from_datadict({'date_year': '0001', 'date_month': '8', 'date_day': '13'}, {}, 'date'),
'13-08-0001',
)
def test_format_value(self):
valid_formats = [