diff options
| author | wdmgsm <wdmgsm@yahoo.com> | 2015-04-08 16:59:15 +0100 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2015-05-06 07:13:00 -0400 |
| commit | 4dcc6493418c78db07761180bf6265f5b2bbccbf (patch) | |
| tree | 101576515e325d1a389e7bdbc2eec89638275ff9 /tests | |
| parent | 6123e6134fba627a49ad379edfc20ae0f73bc9ac (diff) | |
Fixed #24497 -- Added Widget.supports_microseconds attribute
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/forms_tests/tests/test_forms.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/forms_tests/tests/test_forms.py b/tests/forms_tests/tests/test_forms.py index 6aedfa8507..940a55feda 100644 --- a/tests/forms_tests/tests/test_forms.py +++ b/tests/forms_tests/tests/test_forms.py @@ -1455,15 +1455,27 @@ class FormsTestCase(TestCase): def delayed_now_time(): return now.time() + class HiddenInputWithoutMicrosec(HiddenInput): + supports_microseconds = False + + class TextInputWithoutMicrosec(TextInput): + supports_microseconds = False + class DateTimeForm(Form): auto_timestamp = DateTimeField(initial=delayed_now) auto_time_only = TimeField(initial=delayed_now_time) supports_microseconds = DateTimeField(initial=delayed_now, widget=TextInput) + hi_default_microsec = DateTimeField(initial=delayed_now, widget=HiddenInput) + hi_without_microsec = DateTimeField(initial=delayed_now, widget=HiddenInputWithoutMicrosec) + ti_without_microsec = DateTimeField(initial=delayed_now, widget=TextInputWithoutMicrosec) unbound = DateTimeForm() self.assertEqual(unbound['auto_timestamp'].value(), now_no_ms) self.assertEqual(unbound['auto_time_only'].value(), now_no_ms.time()) self.assertEqual(unbound['supports_microseconds'].value(), now) + self.assertEqual(unbound['hi_default_microsec'].value(), now) + self.assertEqual(unbound['hi_without_microsec'].value(), now_no_ms) + self.assertEqual(unbound['ti_without_microsec'].value(), now_no_ms) def test_help_text(self): # You can specify descriptive text for a field by using the 'help_text' argument) |
