Refs #32924 -- Changed test_initial_datetime_values() to use subTests.
This commit is contained in:
parent
469e769299
commit
788441c6ab
|
@ -2112,12 +2112,18 @@ Password: <input type="password" name="password" required></li>
|
||||||
ti_without_microsec = DateTimeField(initial=delayed_now, widget=TextInputWithoutMicrosec)
|
ti_without_microsec = DateTimeField(initial=delayed_now, widget=TextInputWithoutMicrosec)
|
||||||
|
|
||||||
unbound = DateTimeForm()
|
unbound = DateTimeForm()
|
||||||
self.assertEqual(unbound['auto_timestamp'].value(), now_no_ms)
|
cases = [
|
||||||
self.assertEqual(unbound['auto_time_only'].value(), now_no_ms.time())
|
('auto_timestamp', now_no_ms),
|
||||||
self.assertEqual(unbound['supports_microseconds'].value(), now)
|
('auto_time_only', now_no_ms.time()),
|
||||||
self.assertEqual(unbound['hi_default_microsec'].value(), now)
|
('supports_microseconds', now),
|
||||||
self.assertEqual(unbound['hi_without_microsec'].value(), now_no_ms)
|
('hi_default_microsec', now),
|
||||||
self.assertEqual(unbound['ti_without_microsec'].value(), now_no_ms)
|
('hi_without_microsec', now_no_ms),
|
||||||
|
('ti_without_microsec', now_no_ms),
|
||||||
|
]
|
||||||
|
for field_name, expected in cases:
|
||||||
|
with self.subTest(field_name=field_name):
|
||||||
|
actual = unbound[field_name].value()
|
||||||
|
self.assertEqual(actual, expected)
|
||||||
|
|
||||||
def get_datetime_form_with_callable_initial(self, disabled, microseconds=0):
|
def get_datetime_form_with_callable_initial(self, disabled, microseconds=0):
|
||||||
class FakeTime:
|
class FakeTime:
|
||||||
|
|
Loading…
Reference in New Issue