From 384c180e414a982a6cc5ccabc675bcfb4fd80988 Mon Sep 17 00:00:00 2001 From: Claude Paroz Date: Sat, 2 Mar 2013 18:01:24 +0100 Subject: Fixed #19917 -- Added microseconds in default TIME_INPUT_FORMATS Thanks minddust for the report. --- tests/forms_tests/tests/input_formats.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'tests/forms_tests') diff --git a/tests/forms_tests/tests/input_formats.py b/tests/forms_tests/tests/input_formats.py index 7a305dbc2b..eb0e8dcad8 100644 --- a/tests/forms_tests/tests/input_formats.py +++ b/tests/forms_tests/tests/input_formats.py @@ -9,7 +9,8 @@ from django.test import SimpleTestCase @override_settings(TIME_INPUT_FORMATS=["%I:%M:%S %p", "%I:%M %p"], USE_L10N=True) class LocalizedTimeTests(SimpleTestCase): def setUp(self): - # nl/formats.py has customized TIME_INPUT_FORMATS + # nl/formats.py has customized TIME_INPUT_FORMATS: + # ('%H:%M:%S', '%H.%M:%S', '%H.%M', '%H:%M') activate('nl') def tearDown(self): @@ -37,6 +38,10 @@ class LocalizedTimeTests(SimpleTestCase): text = f.widget._format_value(result) self.assertEqual(text, "13:30:00") + # ISO formats are accepted, even if not specified in formats.py + result = f.clean('13:30:05.000155') + self.assertEqual(result, time(13,30,5,155)) + def test_localized_timeField(self): "Localized TimeFields act as unlocalized widgets" f = forms.TimeField(localize=True) -- cgit v1.3