Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
django
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
django
Commits
859eeaa0
Kaydet (Commit)
859eeaa0
authored
Nis 23, 2016
tarafından
Tim Graham
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #26533 -- Renamed Widget._format_value() to format_value().
üst
669c29c8
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
107 additions
and
81 deletions
+107
-81
widgets.py
django/contrib/admin/widgets.py
+1
-1
widgets.py
django/forms/widgets.py
+13
-4
deprecation.txt
docs/internals/deprecation.txt
+2
-0
widgets.txt
docs/ref/forms/widgets.txt
+11
-0
1.10.txt
docs/releases/1.10.txt
+4
-0
test_datefield.py
tests/forms_tests/field_tests/test_datefield.py
+4
-4
test_input_formats.py
tests/forms_tests/tests/test_input_formats.py
+72
-72
No files found.
django/contrib/admin/widgets.py
Dosyayı görüntüle @
859eeaa0
...
@@ -376,7 +376,7 @@ class AdminURLFieldWidget(forms.URLInput):
...
@@ -376,7 +376,7 @@ class AdminURLFieldWidget(forms.URLInput):
def
render
(
self
,
name
,
value
,
attrs
=
None
):
def
render
(
self
,
name
,
value
,
attrs
=
None
):
html
=
super
(
AdminURLFieldWidget
,
self
)
.
render
(
name
,
value
,
attrs
)
html
=
super
(
AdminURLFieldWidget
,
self
)
.
render
(
name
,
value
,
attrs
)
if
value
:
if
value
:
value
=
force_text
(
self
.
_
format_value
(
value
))
value
=
force_text
(
self
.
format_value
(
value
))
final_attrs
=
{
'href'
:
smart_urlquote
(
value
)}
final_attrs
=
{
'href'
:
smart_urlquote
(
value
)}
html
=
format_html
(
html
=
format_html
(
'<p class="url">{} <a{}>{}</a><br />{} {}</p>'
,
'<p class="url">{} <a{}>{}</a><br />{} {}</p>'
,
...
...
django/forms/widgets.py
Dosyayı görüntüle @
859eeaa0
...
@@ -15,6 +15,9 @@ from django.templatetags.static import static
...
@@ -15,6 +15,9 @@ from django.templatetags.static import static
from
django.utils
import
datetime_safe
,
formats
,
six
from
django.utils
import
datetime_safe
,
formats
,
six
from
django.utils.datastructures
import
MultiValueDict
from
django.utils.datastructures
import
MultiValueDict
from
django.utils.dates
import
MONTHS
from
django.utils.dates
import
MONTHS
from
django.utils.deprecation
import
(
RemovedInDjango20Warning
,
RenameMethodsBase
,
)
from
django.utils.encoding
import
(
from
django.utils.encoding
import
(
force_str
,
force_text
,
python_2_unicode_compatible
,
force_str
,
force_text
,
python_2_unicode_compatible
,
)
)
...
@@ -174,7 +177,13 @@ class SubWidget(object):
...
@@ -174,7 +177,13 @@ class SubWidget(object):
return
self
.
parent_widget
.
render
(
*
args
)
return
self
.
parent_widget
.
render
(
*
args
)
class
Widget
(
six
.
with_metaclass
(
MediaDefiningClass
)):
class
RenameWidgetMethods
(
MediaDefiningClass
,
RenameMethodsBase
):
renamed_methods
=
(
(
'_format_value'
,
'format_value'
,
RemovedInDjango20Warning
),
)
class
Widget
(
six
.
with_metaclass
(
RenameWidgetMethods
)):
needs_multipart_form
=
False
# Determines does this widget need multipart form
needs_multipart_form
=
False
# Determines does this widget need multipart form
is_localized
=
False
is_localized
=
False
is_required
=
False
is_required
=
False
...
@@ -248,7 +257,7 @@ class Input(Widget):
...
@@ -248,7 +257,7 @@ class Input(Widget):
"""
"""
input_type
=
None
# Subclasses must define this.
input_type
=
None
# Subclasses must define this.
def
_
format_value
(
self
,
value
):
def
format_value
(
self
,
value
):
if
self
.
is_localized
:
if
self
.
is_localized
:
return
formats
.
localize_input
(
value
)
return
formats
.
localize_input
(
value
)
return
value
return
value
...
@@ -259,7 +268,7 @@ class Input(Widget):
...
@@ -259,7 +268,7 @@ class Input(Widget):
final_attrs
=
self
.
build_attrs
(
attrs
,
type
=
self
.
input_type
,
name
=
name
)
final_attrs
=
self
.
build_attrs
(
attrs
,
type
=
self
.
input_type
,
name
=
name
)
if
value
!=
''
:
if
value
!=
''
:
# Only add the 'value' attribute if a value is non-empty.
# Only add the 'value' attribute if a value is non-empty.
final_attrs
[
'value'
]
=
force_text
(
self
.
_
format_value
(
value
))
final_attrs
[
'value'
]
=
force_text
(
self
.
format_value
(
value
))
return
format_html
(
'<input{} />'
,
flatatt
(
final_attrs
))
return
format_html
(
'<input{} />'
,
flatatt
(
final_attrs
))
...
@@ -443,7 +452,7 @@ class DateTimeBaseInput(TextInput):
...
@@ -443,7 +452,7 @@ class DateTimeBaseInput(TextInput):
super
(
DateTimeBaseInput
,
self
)
.
__init__
(
attrs
)
super
(
DateTimeBaseInput
,
self
)
.
__init__
(
attrs
)
self
.
format
=
format
if
format
else
None
self
.
format
=
format
if
format
else
None
def
_
format_value
(
self
,
value
):
def
format_value
(
self
,
value
):
return
formats
.
localize_input
(
value
,
self
.
format
or
formats
.
get_format
(
self
.
format_key
)[
0
])
return
formats
.
localize_input
(
value
,
self
.
format
or
formats
.
get_format
(
self
.
format_key
)[
0
])
...
...
docs/internals/deprecation.txt
Dosyayı görüntüle @
859eeaa0
...
@@ -163,6 +163,8 @@ details on these changes.
...
@@ -163,6 +163,8 @@ details on these changes.
* In multi-table inheritance, implicit promotion of a ``OneToOneField`` to a
* In multi-table inheritance, implicit promotion of a ``OneToOneField`` to a
``parent_link`` will be removed.
``parent_link`` will be removed.
* Support for ``Widget._format_value()`` will be removed.
.. _deprecation-removed-in-1.10:
.. _deprecation-removed-in-1.10:
1.10
1.10
...
...
docs/ref/forms/widgets.txt
Dosyayı görüntüle @
859eeaa0
...
@@ -228,6 +228,17 @@ foundation for custom widgets.
...
@@ -228,6 +228,17 @@ foundation for custom widgets.
In older versions, this attribute was only defined on the date
In older versions, this attribute was only defined on the date
and time widgets (as ``False``).
and time widgets (as ``False``).
.. method:: format_value(value)
Cleans and returns a value for use in the widget template. ``value``
isn't guaranteed to be valid input, therefore subclass implementations
should program defensively.
.. versionchanged:: 1.10
In older versions, this method is a private API named
``_format_value()``. The old name will work until Django 2.0.
.. method:: id_for_label(self, id_)
.. method:: id_for_label(self, id_)
Returns the HTML ID attribute of this widget for use by a ``<label>``,
Returns the HTML ID attribute of this widget for use by a ``<label>``,
...
...
docs/releases/1.10.txt
Dosyayı görüntüle @
859eeaa0
...
@@ -983,6 +983,10 @@ Miscellaneous
...
@@ -983,6 +983,10 @@ Miscellaneous
* In multi-table inheritance, implicit promotion of a ``OneToOneField`` to a
* In multi-table inheritance, implicit promotion of a ``OneToOneField`` to a
``parent_link`` is deprecated. Add ``parent_link=True`` to such fields.
``parent_link`` is deprecated. Add ``parent_link=True`` to such fields.
* The private API ``Widget._format_value()`` is made public and renamed to
:meth:`~django.forms.Widget.format_value`. The old name will work
through a deprecation period.
.. _removed-features-1.10:
.. _removed-features-1.10:
Features removed in 1.10
Features removed in 1.10
...
...
tests/forms_tests/field_tests/test_datefield.py
Dosyayı görüntüle @
859eeaa0
...
@@ -69,7 +69,7 @@ class DateFieldTest(SimpleTestCase):
...
@@ -69,7 +69,7 @@ class DateFieldTest(SimpleTestCase):
'mydate_year'
:
'2008'
,
'mydate_year'
:
'2008'
,
'mydate_month'
:
'4'
,
'mydate_month'
:
'4'
,
'mydate_day'
:
'1'
,
'mydate_day'
:
'1'
,
'initial-mydate'
:
HiddenInput
()
.
_
format_value
(
date
(
2008
,
4
,
1
)),
'initial-mydate'
:
HiddenInput
()
.
format_value
(
date
(
2008
,
4
,
1
)),
},
initial
=
{
'mydate'
:
date
(
2008
,
4
,
1
)})
},
initial
=
{
'mydate'
:
date
(
2008
,
4
,
1
)})
self
.
assertFalse
(
b
.
has_changed
())
self
.
assertFalse
(
b
.
has_changed
())
...
@@ -77,7 +77,7 @@ class DateFieldTest(SimpleTestCase):
...
@@ -77,7 +77,7 @@ class DateFieldTest(SimpleTestCase):
'mydate_year'
:
'2008'
,
'mydate_year'
:
'2008'
,
'mydate_month'
:
'4'
,
'mydate_month'
:
'4'
,
'mydate_day'
:
'22'
,
'mydate_day'
:
'22'
,
'initial-mydate'
:
HiddenInput
()
.
_
format_value
(
date
(
2008
,
4
,
1
)),
'initial-mydate'
:
HiddenInput
()
.
format_value
(
date
(
2008
,
4
,
1
)),
},
initial
=
{
'mydate'
:
date
(
2008
,
4
,
1
)})
},
initial
=
{
'mydate'
:
date
(
2008
,
4
,
1
)})
self
.
assertTrue
(
b
.
has_changed
())
self
.
assertTrue
(
b
.
has_changed
())
...
@@ -85,7 +85,7 @@ class DateFieldTest(SimpleTestCase):
...
@@ -85,7 +85,7 @@ class DateFieldTest(SimpleTestCase):
'mydate_year'
:
'2008'
,
'mydate_year'
:
'2008'
,
'mydate_month'
:
'4'
,
'mydate_month'
:
'4'
,
'mydate_day'
:
'22'
,
'mydate_day'
:
'22'
,
'initial-mydate'
:
HiddenInput
()
.
_
format_value
(
date
(
2008
,
4
,
1
)),
'initial-mydate'
:
HiddenInput
()
.
format_value
(
date
(
2008
,
4
,
1
)),
},
initial
=
{
'mydate'
:
date
(
2008
,
4
,
22
)})
},
initial
=
{
'mydate'
:
date
(
2008
,
4
,
22
)})
self
.
assertTrue
(
b
.
has_changed
())
self
.
assertTrue
(
b
.
has_changed
())
...
@@ -93,7 +93,7 @@ class DateFieldTest(SimpleTestCase):
...
@@ -93,7 +93,7 @@ class DateFieldTest(SimpleTestCase):
'mydate_year'
:
'2008'
,
'mydate_year'
:
'2008'
,
'mydate_month'
:
'4'
,
'mydate_month'
:
'4'
,
'mydate_day'
:
'22'
,
'mydate_day'
:
'22'
,
'initial-mydate'
:
HiddenInput
()
.
_
format_value
(
date
(
2008
,
4
,
22
)),
'initial-mydate'
:
HiddenInput
()
.
format_value
(
date
(
2008
,
4
,
22
)),
},
initial
=
{
'mydate'
:
date
(
2008
,
4
,
1
)})
},
initial
=
{
'mydate'
:
date
(
2008
,
4
,
1
)})
self
.
assertFalse
(
b
.
has_changed
())
self
.
assertFalse
(
b
.
has_changed
())
...
...
tests/forms_tests/tests/test_input_formats.py
Dosyayı görüntüle @
859eeaa0
...
@@ -27,7 +27,7 @@ class LocalizedTimeTests(SimpleTestCase):
...
@@ -27,7 +27,7 @@ class LocalizedTimeTests(SimpleTestCase):
self
.
assertEqual
(
result
,
time
(
13
,
30
,
5
))
self
.
assertEqual
(
result
,
time
(
13
,
30
,
5
))
# Check that the parsed result does a round trip
# Check that the parsed result does a round trip
text
=
f
.
widget
.
_
format_value
(
result
)
text
=
f
.
widget
.
format_value
(
result
)
self
.
assertEqual
(
text
,
'13:30:05'
)
self
.
assertEqual
(
text
,
'13:30:05'
)
# Parse a time in a valid, but non-default format, get a parsed result
# Parse a time in a valid, but non-default format, get a parsed result
...
@@ -35,7 +35,7 @@ class LocalizedTimeTests(SimpleTestCase):
...
@@ -35,7 +35,7 @@ class LocalizedTimeTests(SimpleTestCase):
self
.
assertEqual
(
result
,
time
(
13
,
30
,
0
))
self
.
assertEqual
(
result
,
time
(
13
,
30
,
0
))
# Check that the parsed result does a round trip to default format
# Check that the parsed result does a round trip to default format
text
=
f
.
widget
.
_
format_value
(
result
)
text
=
f
.
widget
.
format_value
(
result
)
self
.
assertEqual
(
text
,
"13:30:00"
)
self
.
assertEqual
(
text
,
"13:30:00"
)
# ISO formats are accepted, even if not specified in formats.py
# ISO formats are accepted, even if not specified in formats.py
...
@@ -54,7 +54,7 @@ class LocalizedTimeTests(SimpleTestCase):
...
@@ -54,7 +54,7 @@ class LocalizedTimeTests(SimpleTestCase):
self
.
assertEqual
(
result
,
time
(
13
,
30
,
5
))
self
.
assertEqual
(
result
,
time
(
13
,
30
,
5
))
# Check that the parsed result does a round trip to the same format
# Check that the parsed result does a round trip to the same format
text
=
f
.
widget
.
_
format_value
(
result
)
text
=
f
.
widget
.
format_value
(
result
)
self
.
assertEqual
(
text
,
'13:30:05'
)
self
.
assertEqual
(
text
,
'13:30:05'
)
# Parse a time in a valid format, get a parsed result
# Parse a time in a valid format, get a parsed result
...
@@ -62,7 +62,7 @@ class LocalizedTimeTests(SimpleTestCase):
...
@@ -62,7 +62,7 @@ class LocalizedTimeTests(SimpleTestCase):
self
.
assertEqual
(
result
,
time
(
13
,
30
,
0
))
self
.
assertEqual
(
result
,
time
(
13
,
30
,
0
))
# Check that the parsed result does a round trip to default format
# Check that the parsed result does a round trip to default format
text
=
f
.
widget
.
_
format_value
(
result
)
text
=
f
.
widget
.
format_value
(
result
)
self
.
assertEqual
(
text
,
"13:30:00"
)
self
.
assertEqual
(
text
,
"13:30:00"
)
def
test_timeField_with_inputformat
(
self
):
def
test_timeField_with_inputformat
(
self
):
...
@@ -79,7 +79,7 @@ class LocalizedTimeTests(SimpleTestCase):
...
@@ -79,7 +79,7 @@ class LocalizedTimeTests(SimpleTestCase):
self
.
assertEqual
(
result
,
time
(
13
,
30
,
5
))
self
.
assertEqual
(
result
,
time
(
13
,
30
,
5
))
# Check that the parsed result does a round trip to the same format
# Check that the parsed result does a round trip to the same format
text
=
f
.
widget
.
_
format_value
(
result
)
text
=
f
.
widget
.
format_value
(
result
)
self
.
assertEqual
(
text
,
"13:30:05"
)
self
.
assertEqual
(
text
,
"13:30:05"
)
# Parse a time in a valid format, get a parsed result
# Parse a time in a valid format, get a parsed result
...
@@ -87,7 +87,7 @@ class LocalizedTimeTests(SimpleTestCase):
...
@@ -87,7 +87,7 @@ class LocalizedTimeTests(SimpleTestCase):
self
.
assertEqual
(
result
,
time
(
13
,
30
,
0
))
self
.
assertEqual
(
result
,
time
(
13
,
30
,
0
))
# Check that the parsed result does a round trip to default format
# Check that the parsed result does a round trip to default format
text
=
f
.
widget
.
_
format_value
(
result
)
text
=
f
.
widget
.
format_value
(
result
)
self
.
assertEqual
(
text
,
"13:30:00"
)
self
.
assertEqual
(
text
,
"13:30:00"
)
def
test_localized_timeField_with_inputformat
(
self
):
def
test_localized_timeField_with_inputformat
(
self
):
...
@@ -104,7 +104,7 @@ class LocalizedTimeTests(SimpleTestCase):
...
@@ -104,7 +104,7 @@ class LocalizedTimeTests(SimpleTestCase):
self
.
assertEqual
(
result
,
time
(
13
,
30
,
5
))
self
.
assertEqual
(
result
,
time
(
13
,
30
,
5
))
# Check that the parsed result does a round trip to the same format
# Check that the parsed result does a round trip to the same format
text
=
f
.
widget
.
_
format_value
(
result
)
text
=
f
.
widget
.
format_value
(
result
)
self
.
assertEqual
(
text
,
"13:30:05"
)
self
.
assertEqual
(
text
,
"13:30:05"
)
# Parse a time in a valid format, get a parsed result
# Parse a time in a valid format, get a parsed result
...
@@ -112,7 +112,7 @@ class LocalizedTimeTests(SimpleTestCase):
...
@@ -112,7 +112,7 @@ class LocalizedTimeTests(SimpleTestCase):
self
.
assertEqual
(
result
,
time
(
13
,
30
,
0
))
self
.
assertEqual
(
result
,
time
(
13
,
30
,
0
))
# Check that the parsed result does a round trip to default format
# Check that the parsed result does a round trip to default format
text
=
f
.
widget
.
_
format_value
(
result
)
text
=
f
.
widget
.
format_value
(
result
)
self
.
assertEqual
(
text
,
"13:30:00"
)
self
.
assertEqual
(
text
,
"13:30:00"
)
...
@@ -130,7 +130,7 @@ class CustomTimeInputFormatsTests(SimpleTestCase):
...
@@ -130,7 +130,7 @@ class CustomTimeInputFormatsTests(SimpleTestCase):
self
.
assertEqual
(
result
,
time
(
13
,
30
,
5
))
self
.
assertEqual
(
result
,
time
(
13
,
30
,
5
))
# Check that the parsed result does a round trip
# Check that the parsed result does a round trip
text
=
f
.
widget
.
_
format_value
(
result
)
text
=
f
.
widget
.
format_value
(
result
)
self
.
assertEqual
(
text
,
'01:30:05 PM'
)
self
.
assertEqual
(
text
,
'01:30:05 PM'
)
# Parse a time in a valid, but non-default format, get a parsed result
# Parse a time in a valid, but non-default format, get a parsed result
...
@@ -138,7 +138,7 @@ class CustomTimeInputFormatsTests(SimpleTestCase):
...
@@ -138,7 +138,7 @@ class CustomTimeInputFormatsTests(SimpleTestCase):
self
.
assertEqual
(
result
,
time
(
13
,
30
,
0
))
self
.
assertEqual
(
result
,
time
(
13
,
30
,
0
))
# Check that the parsed result does a round trip to default format
# Check that the parsed result does a round trip to default format
text
=
f
.
widget
.
_
format_value
(
result
)
text
=
f
.
widget
.
format_value
(
result
)
self
.
assertEqual
(
text
,
"01:30:00 PM"
)
self
.
assertEqual
(
text
,
"01:30:00 PM"
)
def
test_localized_timeField
(
self
):
def
test_localized_timeField
(
self
):
...
@@ -153,7 +153,7 @@ class CustomTimeInputFormatsTests(SimpleTestCase):
...
@@ -153,7 +153,7 @@ class CustomTimeInputFormatsTests(SimpleTestCase):
self
.
assertEqual
(
result
,
time
(
13
,
30
,
5
))
self
.
assertEqual
(
result
,
time
(
13
,
30
,
5
))
# Check that the parsed result does a round trip to the same format
# Check that the parsed result does a round trip to the same format
text
=
f
.
widget
.
_
format_value
(
result
)
text
=
f
.
widget
.
format_value
(
result
)
self
.
assertEqual
(
text
,
'01:30:05 PM'
)
self
.
assertEqual
(
text
,
'01:30:05 PM'
)
# Parse a time in a valid format, get a parsed result
# Parse a time in a valid format, get a parsed result
...
@@ -161,7 +161,7 @@ class CustomTimeInputFormatsTests(SimpleTestCase):
...
@@ -161,7 +161,7 @@ class CustomTimeInputFormatsTests(SimpleTestCase):
self
.
assertEqual
(
result
,
time
(
13
,
30
,
0
))
self
.
assertEqual
(
result
,
time
(
13
,
30
,
0
))
# Check that the parsed result does a round trip to default format
# Check that the parsed result does a round trip to default format
text
=
f
.
widget
.
_
format_value
(
result
)
text
=
f
.
widget
.
format_value
(
result
)
self
.
assertEqual
(
text
,
"01:30:00 PM"
)
self
.
assertEqual
(
text
,
"01:30:00 PM"
)
def
test_timeField_with_inputformat
(
self
):
def
test_timeField_with_inputformat
(
self
):
...
@@ -178,7 +178,7 @@ class CustomTimeInputFormatsTests(SimpleTestCase):
...
@@ -178,7 +178,7 @@ class CustomTimeInputFormatsTests(SimpleTestCase):
self
.
assertEqual
(
result
,
time
(
13
,
30
,
5
))
self
.
assertEqual
(
result
,
time
(
13
,
30
,
5
))
# Check that the parsed result does a round trip to the same format
# Check that the parsed result does a round trip to the same format
text
=
f
.
widget
.
_
format_value
(
result
)
text
=
f
.
widget
.
format_value
(
result
)
self
.
assertEqual
(
text
,
"01:30:05 PM"
)
self
.
assertEqual
(
text
,
"01:30:05 PM"
)
# Parse a time in a valid format, get a parsed result
# Parse a time in a valid format, get a parsed result
...
@@ -186,7 +186,7 @@ class CustomTimeInputFormatsTests(SimpleTestCase):
...
@@ -186,7 +186,7 @@ class CustomTimeInputFormatsTests(SimpleTestCase):
self
.
assertEqual
(
result
,
time
(
13
,
30
,
0
))
self
.
assertEqual
(
result
,
time
(
13
,
30
,
0
))
# Check that the parsed result does a round trip to default format
# Check that the parsed result does a round trip to default format
text
=
f
.
widget
.
_
format_value
(
result
)
text
=
f
.
widget
.
format_value
(
result
)
self
.
assertEqual
(
text
,
"01:30:00 PM"
)
self
.
assertEqual
(
text
,
"01:30:00 PM"
)
def
test_localized_timeField_with_inputformat
(
self
):
def
test_localized_timeField_with_inputformat
(
self
):
...
@@ -203,7 +203,7 @@ class CustomTimeInputFormatsTests(SimpleTestCase):
...
@@ -203,7 +203,7 @@ class CustomTimeInputFormatsTests(SimpleTestCase):
self
.
assertEqual
(
result
,
time
(
13
,
30
,
5
))
self
.
assertEqual
(
result
,
time
(
13
,
30
,
5
))
# Check that the parsed result does a round trip to the same format
# Check that the parsed result does a round trip to the same format
text
=
f
.
widget
.
_
format_value
(
result
)
text
=
f
.
widget
.
format_value
(
result
)
self
.
assertEqual
(
text
,
"01:30:05 PM"
)
self
.
assertEqual
(
text
,
"01:30:05 PM"
)
# Parse a time in a valid format, get a parsed result
# Parse a time in a valid format, get a parsed result
...
@@ -211,7 +211,7 @@ class CustomTimeInputFormatsTests(SimpleTestCase):
...
@@ -211,7 +211,7 @@ class CustomTimeInputFormatsTests(SimpleTestCase):
self
.
assertEqual
(
result
,
time
(
13
,
30
,
0
))
self
.
assertEqual
(
result
,
time
(
13
,
30
,
0
))
# Check that the parsed result does a round trip to default format
# Check that the parsed result does a round trip to default format
text
=
f
.
widget
.
_
format_value
(
result
)
text
=
f
.
widget
.
format_value
(
result
)
self
.
assertEqual
(
text
,
"01:30:00 PM"
)
self
.
assertEqual
(
text
,
"01:30:00 PM"
)
...
@@ -228,7 +228,7 @@ class SimpleTimeFormatTests(SimpleTestCase):
...
@@ -228,7 +228,7 @@ class SimpleTimeFormatTests(SimpleTestCase):
self
.
assertEqual
(
result
,
time
(
13
,
30
,
5
))
self
.
assertEqual
(
result
,
time
(
13
,
30
,
5
))
# Check that the parsed result does a round trip to the same format
# Check that the parsed result does a round trip to the same format
text
=
f
.
widget
.
_
format_value
(
result
)
text
=
f
.
widget
.
format_value
(
result
)
self
.
assertEqual
(
text
,
"13:30:05"
)
self
.
assertEqual
(
text
,
"13:30:05"
)
# Parse a time in a valid, but non-default format, get a parsed result
# Parse a time in a valid, but non-default format, get a parsed result
...
@@ -236,7 +236,7 @@ class SimpleTimeFormatTests(SimpleTestCase):
...
@@ -236,7 +236,7 @@ class SimpleTimeFormatTests(SimpleTestCase):
self
.
assertEqual
(
result
,
time
(
13
,
30
,
0
))
self
.
assertEqual
(
result
,
time
(
13
,
30
,
0
))
# Check that the parsed result does a round trip to default format
# Check that the parsed result does a round trip to default format
text
=
f
.
widget
.
_
format_value
(
result
)
text
=
f
.
widget
.
format_value
(
result
)
self
.
assertEqual
(
text
,
"13:30:00"
)
self
.
assertEqual
(
text
,
"13:30:00"
)
def
test_localized_timeField
(
self
):
def
test_localized_timeField
(
self
):
...
@@ -251,7 +251,7 @@ class SimpleTimeFormatTests(SimpleTestCase):
...
@@ -251,7 +251,7 @@ class SimpleTimeFormatTests(SimpleTestCase):
self
.
assertEqual
(
result
,
time
(
13
,
30
,
5
))
self
.
assertEqual
(
result
,
time
(
13
,
30
,
5
))
# Check that the parsed result does a round trip to the same format
# Check that the parsed result does a round trip to the same format
text
=
f
.
widget
.
_
format_value
(
result
)
text
=
f
.
widget
.
format_value
(
result
)
self
.
assertEqual
(
text
,
"13:30:05"
)
self
.
assertEqual
(
text
,
"13:30:05"
)
# Parse a time in a valid format, get a parsed result
# Parse a time in a valid format, get a parsed result
...
@@ -259,7 +259,7 @@ class SimpleTimeFormatTests(SimpleTestCase):
...
@@ -259,7 +259,7 @@ class SimpleTimeFormatTests(SimpleTestCase):
self
.
assertEqual
(
result
,
time
(
13
,
30
,
0
))
self
.
assertEqual
(
result
,
time
(
13
,
30
,
0
))
# Check that the parsed result does a round trip to default format
# Check that the parsed result does a round trip to default format
text
=
f
.
widget
.
_
format_value
(
result
)
text
=
f
.
widget
.
format_value
(
result
)
self
.
assertEqual
(
text
,
"13:30:00"
)
self
.
assertEqual
(
text
,
"13:30:00"
)
def
test_timeField_with_inputformat
(
self
):
def
test_timeField_with_inputformat
(
self
):
...
@@ -274,7 +274,7 @@ class SimpleTimeFormatTests(SimpleTestCase):
...
@@ -274,7 +274,7 @@ class SimpleTimeFormatTests(SimpleTestCase):
self
.
assertEqual
(
result
,
time
(
13
,
30
,
5
))
self
.
assertEqual
(
result
,
time
(
13
,
30
,
5
))
# Check that the parsed result does a round trip to the same format
# Check that the parsed result does a round trip to the same format
text
=
f
.
widget
.
_
format_value
(
result
)
text
=
f
.
widget
.
format_value
(
result
)
self
.
assertEqual
(
text
,
"13:30:05"
)
self
.
assertEqual
(
text
,
"13:30:05"
)
# Parse a time in a valid format, get a parsed result
# Parse a time in a valid format, get a parsed result
...
@@ -282,7 +282,7 @@ class SimpleTimeFormatTests(SimpleTestCase):
...
@@ -282,7 +282,7 @@ class SimpleTimeFormatTests(SimpleTestCase):
self
.
assertEqual
(
result
,
time
(
13
,
30
,
0
))
self
.
assertEqual
(
result
,
time
(
13
,
30
,
0
))
# Check that the parsed result does a round trip to default format
# Check that the parsed result does a round trip to default format
text
=
f
.
widget
.
_
format_value
(
result
)
text
=
f
.
widget
.
format_value
(
result
)
self
.
assertEqual
(
text
,
"13:30:00"
)
self
.
assertEqual
(
text
,
"13:30:00"
)
def
test_localized_timeField_with_inputformat
(
self
):
def
test_localized_timeField_with_inputformat
(
self
):
...
@@ -297,7 +297,7 @@ class SimpleTimeFormatTests(SimpleTestCase):
...
@@ -297,7 +297,7 @@ class SimpleTimeFormatTests(SimpleTestCase):
self
.
assertEqual
(
result
,
time
(
13
,
30
,
5
))
self
.
assertEqual
(
result
,
time
(
13
,
30
,
5
))
# Check that the parsed result does a round trip to the same format
# Check that the parsed result does a round trip to the same format
text
=
f
.
widget
.
_
format_value
(
result
)
text
=
f
.
widget
.
format_value
(
result
)
self
.
assertEqual
(
text
,
"13:30:05"
)
self
.
assertEqual
(
text
,
"13:30:05"
)
# Parse a time in a valid format, get a parsed result
# Parse a time in a valid format, get a parsed result
...
@@ -305,7 +305,7 @@ class SimpleTimeFormatTests(SimpleTestCase):
...
@@ -305,7 +305,7 @@ class SimpleTimeFormatTests(SimpleTestCase):
self
.
assertEqual
(
result
,
time
(
13
,
30
,
0
))
self
.
assertEqual
(
result
,
time
(
13
,
30
,
0
))
# Check that the parsed result does a round trip to default format
# Check that the parsed result does a round trip to default format
text
=
f
.
widget
.
_
format_value
(
result
)
text
=
f
.
widget
.
format_value
(
result
)
self
.
assertEqual
(
text
,
"13:30:00"
)
self
.
assertEqual
(
text
,
"13:30:00"
)
...
@@ -332,7 +332,7 @@ class LocalizedDateTests(SimpleTestCase):
...
@@ -332,7 +332,7 @@ class LocalizedDateTests(SimpleTestCase):
self
.
assertEqual
(
result
,
date
(
2010
,
12
,
21
))
self
.
assertEqual
(
result
,
date
(
2010
,
12
,
21
))
# Check that the parsed result does a round trip
# Check that the parsed result does a round trip
text
=
f
.
widget
.
_
format_value
(
result
)
text
=
f
.
widget
.
format_value
(
result
)
self
.
assertEqual
(
text
,
'21.12.2010'
)
self
.
assertEqual
(
text
,
'21.12.2010'
)
# Parse a date in a valid, but non-default format, get a parsed result
# Parse a date in a valid, but non-default format, get a parsed result
...
@@ -340,7 +340,7 @@ class LocalizedDateTests(SimpleTestCase):
...
@@ -340,7 +340,7 @@ class LocalizedDateTests(SimpleTestCase):
self
.
assertEqual
(
result
,
date
(
2010
,
12
,
21
))
self
.
assertEqual
(
result
,
date
(
2010
,
12
,
21
))
# Check that the parsed result does a round trip to default format
# Check that the parsed result does a round trip to default format
text
=
f
.
widget
.
_
format_value
(
result
)
text
=
f
.
widget
.
format_value
(
result
)
self
.
assertEqual
(
text
,
"21.12.2010"
)
self
.
assertEqual
(
text
,
"21.12.2010"
)
def
test_localized_dateField
(
self
):
def
test_localized_dateField
(
self
):
...
@@ -355,7 +355,7 @@ class LocalizedDateTests(SimpleTestCase):
...
@@ -355,7 +355,7 @@ class LocalizedDateTests(SimpleTestCase):
self
.
assertEqual
(
result
,
date
(
2010
,
12
,
21
))
self
.
assertEqual
(
result
,
date
(
2010
,
12
,
21
))
# Check that the parsed result does a round trip to the same format
# Check that the parsed result does a round trip to the same format
text
=
f
.
widget
.
_
format_value
(
result
)
text
=
f
.
widget
.
format_value
(
result
)
self
.
assertEqual
(
text
,
'21.12.2010'
)
self
.
assertEqual
(
text
,
'21.12.2010'
)
# Parse a date in a valid format, get a parsed result
# Parse a date in a valid format, get a parsed result
...
@@ -363,7 +363,7 @@ class LocalizedDateTests(SimpleTestCase):
...
@@ -363,7 +363,7 @@ class LocalizedDateTests(SimpleTestCase):
self
.
assertEqual
(
result
,
date
(
2010
,
12
,
21
))
self
.
assertEqual
(
result
,
date
(
2010
,
12
,
21
))
# Check that the parsed result does a round trip to default format
# Check that the parsed result does a round trip to default format
text
=
f
.
widget
.
_
format_value
(
result
)
text
=
f
.
widget
.
format_value
(
result
)
self
.
assertEqual
(
text
,
"21.12.2010"
)
self
.
assertEqual
(
text
,
"21.12.2010"
)
def
test_dateField_with_inputformat
(
self
):
def
test_dateField_with_inputformat
(
self
):
...
@@ -382,7 +382,7 @@ class LocalizedDateTests(SimpleTestCase):
...
@@ -382,7 +382,7 @@ class LocalizedDateTests(SimpleTestCase):
self
.
assertEqual
(
result
,
date
(
2010
,
12
,
21
))
self
.
assertEqual
(
result
,
date
(
2010
,
12
,
21
))
# Check that the parsed result does a round trip to the same format
# Check that the parsed result does a round trip to the same format
text
=
f
.
widget
.
_
format_value
(
result
)
text
=
f
.
widget
.
format_value
(
result
)
self
.
assertEqual
(
text
,
"21.12.2010"
)
self
.
assertEqual
(
text
,
"21.12.2010"
)
# Parse a date in a valid format, get a parsed result
# Parse a date in a valid format, get a parsed result
...
@@ -390,7 +390,7 @@ class LocalizedDateTests(SimpleTestCase):
...
@@ -390,7 +390,7 @@ class LocalizedDateTests(SimpleTestCase):
self
.
assertEqual
(
result
,
date
(
2010
,
12
,
21
))
self
.
assertEqual
(
result
,
date
(
2010
,
12
,
21
))
# Check that the parsed result does a round trip to default format
# Check that the parsed result does a round trip to default format
text
=
f
.
widget
.
_
format_value
(
result
)
text
=
f
.
widget
.
format_value
(
result
)
self
.
assertEqual
(
text
,
"21.12.2010"
)
self
.
assertEqual
(
text
,
"21.12.2010"
)
def
test_localized_dateField_with_inputformat
(
self
):
def
test_localized_dateField_with_inputformat
(
self
):
...
@@ -409,7 +409,7 @@ class LocalizedDateTests(SimpleTestCase):
...
@@ -409,7 +409,7 @@ class LocalizedDateTests(SimpleTestCase):
self
.
assertEqual
(
result
,
date
(
2010
,
12
,
21
))
self
.
assertEqual
(
result
,
date
(
2010
,
12
,
21
))
# Check that the parsed result does a round trip to the same format
# Check that the parsed result does a round trip to the same format
text
=
f
.
widget
.
_
format_value
(
result
)
text
=
f
.
widget
.
format_value
(
result
)
self
.
assertEqual
(
text
,
"21.12.2010"
)
self
.
assertEqual
(
text
,
"21.12.2010"
)
# Parse a date in a valid format, get a parsed result
# Parse a date in a valid format, get a parsed result
...
@@ -417,7 +417,7 @@ class LocalizedDateTests(SimpleTestCase):
...
@@ -417,7 +417,7 @@ class LocalizedDateTests(SimpleTestCase):
self
.
assertEqual
(
result
,
date
(
2010
,
12
,
21
))
self
.
assertEqual
(
result
,
date
(
2010
,
12
,
21
))
# Check that the parsed result does a round trip to default format
# Check that the parsed result does a round trip to default format
text
=
f
.
widget
.
_
format_value
(
result
)
text
=
f
.
widget
.
format_value
(
result
)
self
.
assertEqual
(
text
,
"21.12.2010"
)
self
.
assertEqual
(
text
,
"21.12.2010"
)
...
@@ -435,7 +435,7 @@ class CustomDateInputFormatsTests(SimpleTestCase):
...
@@ -435,7 +435,7 @@ class CustomDateInputFormatsTests(SimpleTestCase):
self
.
assertEqual
(
result
,
date
(
2010
,
12
,
21
))
self
.
assertEqual
(
result
,
date
(
2010
,
12
,
21
))
# Check that the parsed result does a round trip
# Check that the parsed result does a round trip
text
=
f
.
widget
.
_
format_value
(
result
)
text
=
f
.
widget
.
format_value
(
result
)
self
.
assertEqual
(
text
,
'21.12.2010'
)
self
.
assertEqual
(
text
,
'21.12.2010'
)
# Parse a date in a valid, but non-default format, get a parsed result
# Parse a date in a valid, but non-default format, get a parsed result
...
@@ -443,7 +443,7 @@ class CustomDateInputFormatsTests(SimpleTestCase):
...
@@ -443,7 +443,7 @@ class CustomDateInputFormatsTests(SimpleTestCase):
self
.
assertEqual
(
result
,
date
(
2010
,
12
,
21
))
self
.
assertEqual
(
result
,
date
(
2010
,
12
,
21
))
# Check that the parsed result does a round trip to default format
# Check that the parsed result does a round trip to default format
text
=
f
.
widget
.
_
format_value
(
result
)
text
=
f
.
widget
.
format_value
(
result
)
self
.
assertEqual
(
text
,
"21.12.2010"
)
self
.
assertEqual
(
text
,
"21.12.2010"
)
def
test_localized_dateField
(
self
):
def
test_localized_dateField
(
self
):
...
@@ -458,7 +458,7 @@ class CustomDateInputFormatsTests(SimpleTestCase):
...
@@ -458,7 +458,7 @@ class CustomDateInputFormatsTests(SimpleTestCase):
self
.
assertEqual
(
result
,
date
(
2010
,
12
,
21
))
self
.
assertEqual
(
result
,
date
(
2010
,
12
,
21
))
# Check that the parsed result does a round trip to the same format
# Check that the parsed result does a round trip to the same format
text
=
f
.
widget
.
_
format_value
(
result
)
text
=
f
.
widget
.
format_value
(
result
)
self
.
assertEqual
(
text
,
'21.12.2010'
)
self
.
assertEqual
(
text
,
'21.12.2010'
)
# Parse a date in a valid format, get a parsed result
# Parse a date in a valid format, get a parsed result
...
@@ -466,7 +466,7 @@ class CustomDateInputFormatsTests(SimpleTestCase):
...
@@ -466,7 +466,7 @@ class CustomDateInputFormatsTests(SimpleTestCase):
self
.
assertEqual
(
result
,
date
(
2010
,
12
,
21
))
self
.
assertEqual
(
result
,
date
(
2010
,
12
,
21
))
# Check that the parsed result does a round trip to default format
# Check that the parsed result does a round trip to default format
text
=
f
.
widget
.
_
format_value
(
result
)
text
=
f
.
widget
.
format_value
(
result
)
self
.
assertEqual
(
text
,
"21.12.2010"
)
self
.
assertEqual
(
text
,
"21.12.2010"
)
def
test_dateField_with_inputformat
(
self
):
def
test_dateField_with_inputformat
(
self
):
...
@@ -483,7 +483,7 @@ class CustomDateInputFormatsTests(SimpleTestCase):
...
@@ -483,7 +483,7 @@ class CustomDateInputFormatsTests(SimpleTestCase):
self
.
assertEqual
(
result
,
date
(
2010
,
12
,
21
))
self
.
assertEqual
(
result
,
date
(
2010
,
12
,
21
))
# Check that the parsed result does a round trip to the same format
# Check that the parsed result does a round trip to the same format
text
=
f
.
widget
.
_
format_value
(
result
)
text
=
f
.
widget
.
format_value
(
result
)
self
.
assertEqual
(
text
,
"21.12.2010"
)
self
.
assertEqual
(
text
,
"21.12.2010"
)
# Parse a date in a valid format, get a parsed result
# Parse a date in a valid format, get a parsed result
...
@@ -491,7 +491,7 @@ class CustomDateInputFormatsTests(SimpleTestCase):
...
@@ -491,7 +491,7 @@ class CustomDateInputFormatsTests(SimpleTestCase):
self
.
assertEqual
(
result
,
date
(
2010
,
12
,
21
))
self
.
assertEqual
(
result
,
date
(
2010
,
12
,
21
))
# Check that the parsed result does a round trip to default format
# Check that the parsed result does a round trip to default format
text
=
f
.
widget
.
_
format_value
(
result
)
text
=
f
.
widget
.
format_value
(
result
)
self
.
assertEqual
(
text
,
"21.12.2010"
)
self
.
assertEqual
(
text
,
"21.12.2010"
)
def
test_localized_dateField_with_inputformat
(
self
):
def
test_localized_dateField_with_inputformat
(
self
):
...
@@ -508,7 +508,7 @@ class CustomDateInputFormatsTests(SimpleTestCase):
...
@@ -508,7 +508,7 @@ class CustomDateInputFormatsTests(SimpleTestCase):
self
.
assertEqual
(
result
,
date
(
2010
,
12
,
21
))
self
.
assertEqual
(
result
,
date
(
2010
,
12
,
21
))
# Check that the parsed result does a round trip to the same format
# Check that the parsed result does a round trip to the same format
text
=
f
.
widget
.
_
format_value
(
result
)
text
=
f
.
widget
.
format_value
(
result
)
self
.
assertEqual
(
text
,
"21.12.2010"
)
self
.
assertEqual
(
text
,
"21.12.2010"
)
# Parse a date in a valid format, get a parsed result
# Parse a date in a valid format, get a parsed result
...
@@ -516,7 +516,7 @@ class CustomDateInputFormatsTests(SimpleTestCase):
...
@@ -516,7 +516,7 @@ class CustomDateInputFormatsTests(SimpleTestCase):
self
.
assertEqual
(
result
,
date
(
2010
,
12
,
21
))
self
.
assertEqual
(
result
,
date
(
2010
,
12
,
21
))
# Check that the parsed result does a round trip to default format
# Check that the parsed result does a round trip to default format
text
=
f
.
widget
.
_
format_value
(
result
)
text
=
f
.
widget
.
format_value
(
result
)
self
.
assertEqual
(
text
,
"21.12.2010"
)
self
.
assertEqual
(
text
,
"21.12.2010"
)
...
@@ -533,7 +533,7 @@ class SimpleDateFormatTests(SimpleTestCase):
...
@@ -533,7 +533,7 @@ class SimpleDateFormatTests(SimpleTestCase):
self
.
assertEqual
(
result
,
date
(
2010
,
12
,
21
))
self
.
assertEqual
(
result
,
date
(
2010
,
12
,
21
))
# Check that the parsed result does a round trip to the same format
# Check that the parsed result does a round trip to the same format
text
=
f
.
widget
.
_
format_value
(
result
)
text
=
f
.
widget
.
format_value
(
result
)
self
.
assertEqual
(
text
,
"2010-12-21"
)
self
.
assertEqual
(
text
,
"2010-12-21"
)
# Parse a date in a valid, but non-default format, get a parsed result
# Parse a date in a valid, but non-default format, get a parsed result
...
@@ -541,7 +541,7 @@ class SimpleDateFormatTests(SimpleTestCase):
...
@@ -541,7 +541,7 @@ class SimpleDateFormatTests(SimpleTestCase):
self
.
assertEqual
(
result
,
date
(
2010
,
12
,
21
))
self
.
assertEqual
(
result
,
date
(
2010
,
12
,
21
))
# Check that the parsed result does a round trip to default format
# Check that the parsed result does a round trip to default format
text
=
f
.
widget
.
_
format_value
(
result
)
text
=
f
.
widget
.
format_value
(
result
)
self
.
assertEqual
(
text
,
"2010-12-21"
)
self
.
assertEqual
(
text
,
"2010-12-21"
)
def
test_localized_dateField
(
self
):
def
test_localized_dateField
(
self
):
...
@@ -556,7 +556,7 @@ class SimpleDateFormatTests(SimpleTestCase):
...
@@ -556,7 +556,7 @@ class SimpleDateFormatTests(SimpleTestCase):
self
.
assertEqual
(
result
,
date
(
2010
,
12
,
21
))
self
.
assertEqual
(
result
,
date
(
2010
,
12
,
21
))
# Check that the parsed result does a round trip to the same format
# Check that the parsed result does a round trip to the same format
text
=
f
.
widget
.
_
format_value
(
result
)
text
=
f
.
widget
.
format_value
(
result
)
self
.
assertEqual
(
text
,
"2010-12-21"
)
self
.
assertEqual
(
text
,
"2010-12-21"
)
# Parse a date in a valid format, get a parsed result
# Parse a date in a valid format, get a parsed result
...
@@ -564,7 +564,7 @@ class SimpleDateFormatTests(SimpleTestCase):
...
@@ -564,7 +564,7 @@ class SimpleDateFormatTests(SimpleTestCase):
self
.
assertEqual
(
result
,
date
(
2010
,
12
,
21
))
self
.
assertEqual
(
result
,
date
(
2010
,
12
,
21
))
# Check that the parsed result does a round trip to default format
# Check that the parsed result does a round trip to default format
text
=
f
.
widget
.
_
format_value
(
result
)
text
=
f
.
widget
.
format_value
(
result
)
self
.
assertEqual
(
text
,
"2010-12-21"
)
self
.
assertEqual
(
text
,
"2010-12-21"
)
def
test_dateField_with_inputformat
(
self
):
def
test_dateField_with_inputformat
(
self
):
...
@@ -579,7 +579,7 @@ class SimpleDateFormatTests(SimpleTestCase):
...
@@ -579,7 +579,7 @@ class SimpleDateFormatTests(SimpleTestCase):
self
.
assertEqual
(
result
,
date
(
2010
,
12
,
21
))
self
.
assertEqual
(
result
,
date
(
2010
,
12
,
21
))
# Check that the parsed result does a round trip to the same format
# Check that the parsed result does a round trip to the same format
text
=
f
.
widget
.
_
format_value
(
result
)
text
=
f
.
widget
.
format_value
(
result
)
self
.
assertEqual
(
text
,
"2010-12-21"
)
self
.
assertEqual
(
text
,
"2010-12-21"
)
# Parse a date in a valid format, get a parsed result
# Parse a date in a valid format, get a parsed result
...
@@ -587,7 +587,7 @@ class SimpleDateFormatTests(SimpleTestCase):
...
@@ -587,7 +587,7 @@ class SimpleDateFormatTests(SimpleTestCase):
self
.
assertEqual
(
result
,
date
(
2010
,
12
,
21
))
self
.
assertEqual
(
result
,
date
(
2010
,
12
,
21
))
# Check that the parsed result does a round trip to default format
# Check that the parsed result does a round trip to default format
text
=
f
.
widget
.
_
format_value
(
result
)
text
=
f
.
widget
.
format_value
(
result
)
self
.
assertEqual
(
text
,
"2010-12-21"
)
self
.
assertEqual
(
text
,
"2010-12-21"
)
def
test_localized_dateField_with_inputformat
(
self
):
def
test_localized_dateField_with_inputformat
(
self
):
...
@@ -602,7 +602,7 @@ class SimpleDateFormatTests(SimpleTestCase):
...
@@ -602,7 +602,7 @@ class SimpleDateFormatTests(SimpleTestCase):
self
.
assertEqual
(
result
,
date
(
2010
,
12
,
21
))
self
.
assertEqual
(
result
,
date
(
2010
,
12
,
21
))
# Check that the parsed result does a round trip to the same format
# Check that the parsed result does a round trip to the same format
text
=
f
.
widget
.
_
format_value
(
result
)
text
=
f
.
widget
.
format_value
(
result
)
self
.
assertEqual
(
text
,
"2010-12-21"
)
self
.
assertEqual
(
text
,
"2010-12-21"
)
# Parse a date in a valid format, get a parsed result
# Parse a date in a valid format, get a parsed result
...
@@ -610,7 +610,7 @@ class SimpleDateFormatTests(SimpleTestCase):
...
@@ -610,7 +610,7 @@ class SimpleDateFormatTests(SimpleTestCase):
self
.
assertEqual
(
result
,
date
(
2010
,
12
,
21
))
self
.
assertEqual
(
result
,
date
(
2010
,
12
,
21
))
# Check that the parsed result does a round trip to default format
# Check that the parsed result does a round trip to default format
text
=
f
.
widget
.
_
format_value
(
result
)
text
=
f
.
widget
.
format_value
(
result
)
self
.
assertEqual
(
text
,
"2010-12-21"
)
self
.
assertEqual
(
text
,
"2010-12-21"
)
...
@@ -637,7 +637,7 @@ class LocalizedDateTimeTests(SimpleTestCase):
...
@@ -637,7 +637,7 @@ class LocalizedDateTimeTests(SimpleTestCase):
self
.
assertEqual
(
result
,
datetime
(
2010
,
12
,
21
,
13
,
30
,
5
))
self
.
assertEqual
(
result
,
datetime
(
2010
,
12
,
21
,
13
,
30
,
5
))
# Check that the parsed result does a round trip
# Check that the parsed result does a round trip
text
=
f
.
widget
.
_
format_value
(
result
)
text
=
f
.
widget
.
format_value
(
result
)
self
.
assertEqual
(
text
,
'21.12.2010 13:30:05'
)
self
.
assertEqual
(
text
,
'21.12.2010 13:30:05'
)
# Parse a date in a valid, but non-default format, get a parsed result
# Parse a date in a valid, but non-default format, get a parsed result
...
@@ -645,7 +645,7 @@ class LocalizedDateTimeTests(SimpleTestCase):
...
@@ -645,7 +645,7 @@ class LocalizedDateTimeTests(SimpleTestCase):
self
.
assertEqual
(
result
,
datetime
(
2010
,
12
,
21
,
13
,
30
))
self
.
assertEqual
(
result
,
datetime
(
2010
,
12
,
21
,
13
,
30
))
# Check that the parsed result does a round trip to default format
# Check that the parsed result does a round trip to default format
text
=
f
.
widget
.
_
format_value
(
result
)
text
=
f
.
widget
.
format_value
(
result
)
self
.
assertEqual
(
text
,
"21.12.2010 13:30:00"
)
self
.
assertEqual
(
text
,
"21.12.2010 13:30:00"
)
def
test_localized_dateTimeField
(
self
):
def
test_localized_dateTimeField
(
self
):
...
@@ -660,7 +660,7 @@ class LocalizedDateTimeTests(SimpleTestCase):
...
@@ -660,7 +660,7 @@ class LocalizedDateTimeTests(SimpleTestCase):
self
.
assertEqual
(
result
,
datetime
(
2010
,
12
,
21
,
13
,
30
,
5
))
self
.
assertEqual
(
result
,
datetime
(
2010
,
12
,
21
,
13
,
30
,
5
))
# Check that the parsed result does a round trip to the same format
# Check that the parsed result does a round trip to the same format
text
=
f
.
widget
.
_
format_value
(
result
)
text
=
f
.
widget
.
format_value
(
result
)
self
.
assertEqual
(
text
,
'21.12.2010 13:30:05'
)
self
.
assertEqual
(
text
,
'21.12.2010 13:30:05'
)
# Parse a date in a valid format, get a parsed result
# Parse a date in a valid format, get a parsed result
...
@@ -668,7 +668,7 @@ class LocalizedDateTimeTests(SimpleTestCase):
...
@@ -668,7 +668,7 @@ class LocalizedDateTimeTests(SimpleTestCase):
self
.
assertEqual
(
result
,
datetime
(
2010
,
12
,
21
,
13
,
30
))
self
.
assertEqual
(
result
,
datetime
(
2010
,
12
,
21
,
13
,
30
))
# Check that the parsed result does a round trip to default format
# Check that the parsed result does a round trip to default format
text
=
f
.
widget
.
_
format_value
(
result
)
text
=
f
.
widget
.
format_value
(
result
)
self
.
assertEqual
(
text
,
"21.12.2010 13:30:00"
)
self
.
assertEqual
(
text
,
"21.12.2010 13:30:00"
)
def
test_dateTimeField_with_inputformat
(
self
):
def
test_dateTimeField_with_inputformat
(
self
):
...
@@ -687,7 +687,7 @@ class LocalizedDateTimeTests(SimpleTestCase):
...
@@ -687,7 +687,7 @@ class LocalizedDateTimeTests(SimpleTestCase):
self
.
assertEqual
(
result
,
datetime
(
2010
,
12
,
21
,
13
,
30
,
5
))
self
.
assertEqual
(
result
,
datetime
(
2010
,
12
,
21
,
13
,
30
,
5
))
# Check that the parsed result does a round trip to the same format
# Check that the parsed result does a round trip to the same format
text
=
f
.
widget
.
_
format_value
(
result
)
text
=
f
.
widget
.
format_value
(
result
)
self
.
assertEqual
(
text
,
"21.12.2010 13:30:05"
)
self
.
assertEqual
(
text
,
"21.12.2010 13:30:05"
)
# Parse a date in a valid format, get a parsed result
# Parse a date in a valid format, get a parsed result
...
@@ -695,7 +695,7 @@ class LocalizedDateTimeTests(SimpleTestCase):
...
@@ -695,7 +695,7 @@ class LocalizedDateTimeTests(SimpleTestCase):
self
.
assertEqual
(
result
,
datetime
(
2010
,
12
,
21
,
13
,
30
))
self
.
assertEqual
(
result
,
datetime
(
2010
,
12
,
21
,
13
,
30
))
# Check that the parsed result does a round trip to default format
# Check that the parsed result does a round trip to default format
text
=
f
.
widget
.
_
format_value
(
result
)
text
=
f
.
widget
.
format_value
(
result
)
self
.
assertEqual
(
text
,
"21.12.2010 13:30:00"
)
self
.
assertEqual
(
text
,
"21.12.2010 13:30:00"
)
def
test_localized_dateTimeField_with_inputformat
(
self
):
def
test_localized_dateTimeField_with_inputformat
(
self
):
...
@@ -714,7 +714,7 @@ class LocalizedDateTimeTests(SimpleTestCase):
...
@@ -714,7 +714,7 @@ class LocalizedDateTimeTests(SimpleTestCase):
self
.
assertEqual
(
result
,
datetime
(
2010
,
12
,
21
,
13
,
30
,
5
))
self
.
assertEqual
(
result
,
datetime
(
2010
,
12
,
21
,
13
,
30
,
5
))
# Check that the parsed result does a round trip to the same format
# Check that the parsed result does a round trip to the same format
text
=
f
.
widget
.
_
format_value
(
result
)
text
=
f
.
widget
.
format_value
(
result
)
self
.
assertEqual
(
text
,
"21.12.2010 13:30:05"
)
self
.
assertEqual
(
text
,
"21.12.2010 13:30:05"
)
# Parse a date in a valid format, get a parsed result
# Parse a date in a valid format, get a parsed result
...
@@ -722,7 +722,7 @@ class LocalizedDateTimeTests(SimpleTestCase):
...
@@ -722,7 +722,7 @@ class LocalizedDateTimeTests(SimpleTestCase):
self
.
assertEqual
(
result
,
datetime
(
2010
,
12
,
21
,
13
,
30
))
self
.
assertEqual
(
result
,
datetime
(
2010
,
12
,
21
,
13
,
30
))
# Check that the parsed result does a round trip to default format
# Check that the parsed result does a round trip to default format
text
=
f
.
widget
.
_
format_value
(
result
)
text
=
f
.
widget
.
format_value
(
result
)
self
.
assertEqual
(
text
,
"21.12.2010 13:30:00"
)
self
.
assertEqual
(
text
,
"21.12.2010 13:30:00"
)
...
@@ -740,7 +740,7 @@ class CustomDateTimeInputFormatsTests(SimpleTestCase):
...
@@ -740,7 +740,7 @@ class CustomDateTimeInputFormatsTests(SimpleTestCase):
self
.
assertEqual
(
result
,
datetime
(
2010
,
12
,
21
,
13
,
30
,
5
))
self
.
assertEqual
(
result
,
datetime
(
2010
,
12
,
21
,
13
,
30
,
5
))
# Check that the parsed result does a round trip
# Check that the parsed result does a round trip
text
=
f
.
widget
.
_
format_value
(
result
)
text
=
f
.
widget
.
format_value
(
result
)
self
.
assertEqual
(
text
,
'01:30:05 PM 21/12/2010'
)
self
.
assertEqual
(
text
,
'01:30:05 PM 21/12/2010'
)
# Parse a date in a valid, but non-default format, get a parsed result
# Parse a date in a valid, but non-default format, get a parsed result
...
@@ -748,7 +748,7 @@ class CustomDateTimeInputFormatsTests(SimpleTestCase):
...
@@ -748,7 +748,7 @@ class CustomDateTimeInputFormatsTests(SimpleTestCase):
self
.
assertEqual
(
result
,
datetime
(
2010
,
12
,
21
,
13
,
30
))
self
.
assertEqual
(
result
,
datetime
(
2010
,
12
,
21
,
13
,
30
))
# Check that the parsed result does a round trip to default format
# Check that the parsed result does a round trip to default format
text
=
f
.
widget
.
_
format_value
(
result
)
text
=
f
.
widget
.
format_value
(
result
)
self
.
assertEqual
(
text
,
"01:30:00 PM 21/12/2010"
)
self
.
assertEqual
(
text
,
"01:30:00 PM 21/12/2010"
)
def
test_localized_dateTimeField
(
self
):
def
test_localized_dateTimeField
(
self
):
...
@@ -763,7 +763,7 @@ class CustomDateTimeInputFormatsTests(SimpleTestCase):
...
@@ -763,7 +763,7 @@ class CustomDateTimeInputFormatsTests(SimpleTestCase):
self
.
assertEqual
(
result
,
datetime
(
2010
,
12
,
21
,
13
,
30
,
5
))
self
.
assertEqual
(
result
,
datetime
(
2010
,
12
,
21
,
13
,
30
,
5
))
# Check that the parsed result does a round trip to the same format
# Check that the parsed result does a round trip to the same format
text
=
f
.
widget
.
_
format_value
(
result
)
text
=
f
.
widget
.
format_value
(
result
)
self
.
assertEqual
(
text
,
'01:30:05 PM 21/12/2010'
)
self
.
assertEqual
(
text
,
'01:30:05 PM 21/12/2010'
)
# Parse a date in a valid format, get a parsed result
# Parse a date in a valid format, get a parsed result
...
@@ -771,7 +771,7 @@ class CustomDateTimeInputFormatsTests(SimpleTestCase):
...
@@ -771,7 +771,7 @@ class CustomDateTimeInputFormatsTests(SimpleTestCase):
self
.
assertEqual
(
result
,
datetime
(
2010
,
12
,
21
,
13
,
30
))
self
.
assertEqual
(
result
,
datetime
(
2010
,
12
,
21
,
13
,
30
))
# Check that the parsed result does a round trip to default format
# Check that the parsed result does a round trip to default format
text
=
f
.
widget
.
_
format_value
(
result
)
text
=
f
.
widget
.
format_value
(
result
)
self
.
assertEqual
(
text
,
"01:30:00 PM 21/12/2010"
)
self
.
assertEqual
(
text
,
"01:30:00 PM 21/12/2010"
)
def
test_dateTimeField_with_inputformat
(
self
):
def
test_dateTimeField_with_inputformat
(
self
):
...
@@ -788,7 +788,7 @@ class CustomDateTimeInputFormatsTests(SimpleTestCase):
...
@@ -788,7 +788,7 @@ class CustomDateTimeInputFormatsTests(SimpleTestCase):
self
.
assertEqual
(
result
,
datetime
(
2010
,
12
,
21
,
13
,
30
,
5
))
self
.
assertEqual
(
result
,
datetime
(
2010
,
12
,
21
,
13
,
30
,
5
))
# Check that the parsed result does a round trip to the same format
# Check that the parsed result does a round trip to the same format
text
=
f
.
widget
.
_
format_value
(
result
)
text
=
f
.
widget
.
format_value
(
result
)
self
.
assertEqual
(
text
,
"01:30:05 PM 21/12/2010"
)
self
.
assertEqual
(
text
,
"01:30:05 PM 21/12/2010"
)
# Parse a date in a valid format, get a parsed result
# Parse a date in a valid format, get a parsed result
...
@@ -796,7 +796,7 @@ class CustomDateTimeInputFormatsTests(SimpleTestCase):
...
@@ -796,7 +796,7 @@ class CustomDateTimeInputFormatsTests(SimpleTestCase):
self
.
assertEqual
(
result
,
datetime
(
2010
,
12
,
21
,
13
,
30
))
self
.
assertEqual
(
result
,
datetime
(
2010
,
12
,
21
,
13
,
30
))
# Check that the parsed result does a round trip to default format
# Check that the parsed result does a round trip to default format
text
=
f
.
widget
.
_
format_value
(
result
)
text
=
f
.
widget
.
format_value
(
result
)
self
.
assertEqual
(
text
,
"01:30:00 PM 21/12/2010"
)
self
.
assertEqual
(
text
,
"01:30:00 PM 21/12/2010"
)
def
test_localized_dateTimeField_with_inputformat
(
self
):
def
test_localized_dateTimeField_with_inputformat
(
self
):
...
@@ -813,7 +813,7 @@ class CustomDateTimeInputFormatsTests(SimpleTestCase):
...
@@ -813,7 +813,7 @@ class CustomDateTimeInputFormatsTests(SimpleTestCase):
self
.
assertEqual
(
result
,
datetime
(
2010
,
12
,
21
,
13
,
30
,
5
))
self
.
assertEqual
(
result
,
datetime
(
2010
,
12
,
21
,
13
,
30
,
5
))
# Check that the parsed result does a round trip to the same format
# Check that the parsed result does a round trip to the same format
text
=
f
.
widget
.
_
format_value
(
result
)
text
=
f
.
widget
.
format_value
(
result
)
self
.
assertEqual
(
text
,
"01:30:05 PM 21/12/2010"
)
self
.
assertEqual
(
text
,
"01:30:05 PM 21/12/2010"
)
# Parse a date in a valid format, get a parsed result
# Parse a date in a valid format, get a parsed result
...
@@ -821,7 +821,7 @@ class CustomDateTimeInputFormatsTests(SimpleTestCase):
...
@@ -821,7 +821,7 @@ class CustomDateTimeInputFormatsTests(SimpleTestCase):
self
.
assertEqual
(
result
,
datetime
(
2010
,
12
,
21
,
13
,
30
))
self
.
assertEqual
(
result
,
datetime
(
2010
,
12
,
21
,
13
,
30
))
# Check that the parsed result does a round trip to default format
# Check that the parsed result does a round trip to default format
text
=
f
.
widget
.
_
format_value
(
result
)
text
=
f
.
widget
.
format_value
(
result
)
self
.
assertEqual
(
text
,
"01:30:00 PM 21/12/2010"
)
self
.
assertEqual
(
text
,
"01:30:00 PM 21/12/2010"
)
...
@@ -838,7 +838,7 @@ class SimpleDateTimeFormatTests(SimpleTestCase):
...
@@ -838,7 +838,7 @@ class SimpleDateTimeFormatTests(SimpleTestCase):
self
.
assertEqual
(
result
,
datetime
(
2010
,
12
,
21
,
13
,
30
,
5
))
self
.
assertEqual
(
result
,
datetime
(
2010
,
12
,
21
,
13
,
30
,
5
))
# Check that the parsed result does a round trip to the same format
# Check that the parsed result does a round trip to the same format
text
=
f
.
widget
.
_
format_value
(
result
)
text
=
f
.
widget
.
format_value
(
result
)
self
.
assertEqual
(
text
,
"2010-12-21 13:30:05"
)
self
.
assertEqual
(
text
,
"2010-12-21 13:30:05"
)
# Parse a date in a valid, but non-default format, get a parsed result
# Parse a date in a valid, but non-default format, get a parsed result
...
@@ -846,7 +846,7 @@ class SimpleDateTimeFormatTests(SimpleTestCase):
...
@@ -846,7 +846,7 @@ class SimpleDateTimeFormatTests(SimpleTestCase):
self
.
assertEqual
(
result
,
datetime
(
2010
,
12
,
21
,
13
,
30
,
5
))
self
.
assertEqual
(
result
,
datetime
(
2010
,
12
,
21
,
13
,
30
,
5
))
# Check that the parsed result does a round trip to default format
# Check that the parsed result does a round trip to default format
text
=
f
.
widget
.
_
format_value
(
result
)
text
=
f
.
widget
.
format_value
(
result
)
self
.
assertEqual
(
text
,
"2010-12-21 13:30:05"
)
self
.
assertEqual
(
text
,
"2010-12-21 13:30:05"
)
def
test_localized_dateTimeField
(
self
):
def
test_localized_dateTimeField
(
self
):
...
@@ -861,7 +861,7 @@ class SimpleDateTimeFormatTests(SimpleTestCase):
...
@@ -861,7 +861,7 @@ class SimpleDateTimeFormatTests(SimpleTestCase):
self
.
assertEqual
(
result
,
datetime
(
2010
,
12
,
21
,
13
,
30
,
5
))
self
.
assertEqual
(
result
,
datetime
(
2010
,
12
,
21
,
13
,
30
,
5
))
# Check that the parsed result does a round trip to the same format
# Check that the parsed result does a round trip to the same format
text
=
f
.
widget
.
_
format_value
(
result
)
text
=
f
.
widget
.
format_value
(
result
)
self
.
assertEqual
(
text
,
"2010-12-21 13:30:05"
)
self
.
assertEqual
(
text
,
"2010-12-21 13:30:05"
)
# Parse a date in a valid format, get a parsed result
# Parse a date in a valid format, get a parsed result
...
@@ -869,7 +869,7 @@ class SimpleDateTimeFormatTests(SimpleTestCase):
...
@@ -869,7 +869,7 @@ class SimpleDateTimeFormatTests(SimpleTestCase):
self
.
assertEqual
(
result
,
datetime
(
2010
,
12
,
21
,
13
,
30
,
5
))
self
.
assertEqual
(
result
,
datetime
(
2010
,
12
,
21
,
13
,
30
,
5
))
# Check that the parsed result does a round trip to default format
# Check that the parsed result does a round trip to default format
text
=
f
.
widget
.
_
format_value
(
result
)
text
=
f
.
widget
.
format_value
(
result
)
self
.
assertEqual
(
text
,
"2010-12-21 13:30:05"
)
self
.
assertEqual
(
text
,
"2010-12-21 13:30:05"
)
def
test_dateTimeField_with_inputformat
(
self
):
def
test_dateTimeField_with_inputformat
(
self
):
...
@@ -884,7 +884,7 @@ class SimpleDateTimeFormatTests(SimpleTestCase):
...
@@ -884,7 +884,7 @@ class SimpleDateTimeFormatTests(SimpleTestCase):
self
.
assertEqual
(
result
,
datetime
(
2010
,
12
,
21
,
13
,
30
,
5
))
self
.
assertEqual
(
result
,
datetime
(
2010
,
12
,
21
,
13
,
30
,
5
))
# Check that the parsed result does a round trip to the same format
# Check that the parsed result does a round trip to the same format
text
=
f
.
widget
.
_
format_value
(
result
)
text
=
f
.
widget
.
format_value
(
result
)
self
.
assertEqual
(
text
,
"2010-12-21 13:30:05"
)
self
.
assertEqual
(
text
,
"2010-12-21 13:30:05"
)
# Parse a date in a valid format, get a parsed result
# Parse a date in a valid format, get a parsed result
...
@@ -892,7 +892,7 @@ class SimpleDateTimeFormatTests(SimpleTestCase):
...
@@ -892,7 +892,7 @@ class SimpleDateTimeFormatTests(SimpleTestCase):
self
.
assertEqual
(
result
,
datetime
(
2010
,
12
,
21
,
13
,
30
))
self
.
assertEqual
(
result
,
datetime
(
2010
,
12
,
21
,
13
,
30
))
# Check that the parsed result does a round trip to default format
# Check that the parsed result does a round trip to default format
text
=
f
.
widget
.
_
format_value
(
result
)
text
=
f
.
widget
.
format_value
(
result
)
self
.
assertEqual
(
text
,
"2010-12-21 13:30:00"
)
self
.
assertEqual
(
text
,
"2010-12-21 13:30:00"
)
def
test_localized_dateTimeField_with_inputformat
(
self
):
def
test_localized_dateTimeField_with_inputformat
(
self
):
...
@@ -907,7 +907,7 @@ class SimpleDateTimeFormatTests(SimpleTestCase):
...
@@ -907,7 +907,7 @@ class SimpleDateTimeFormatTests(SimpleTestCase):
self
.
assertEqual
(
result
,
datetime
(
2010
,
12
,
21
,
13
,
30
,
5
))
self
.
assertEqual
(
result
,
datetime
(
2010
,
12
,
21
,
13
,
30
,
5
))
# Check that the parsed result does a round trip to the same format
# Check that the parsed result does a round trip to the same format
text
=
f
.
widget
.
_
format_value
(
result
)
text
=
f
.
widget
.
format_value
(
result
)
self
.
assertEqual
(
text
,
"2010-12-21 13:30:05"
)
self
.
assertEqual
(
text
,
"2010-12-21 13:30:05"
)
# Parse a date in a valid format, get a parsed result
# Parse a date in a valid format, get a parsed result
...
@@ -915,5 +915,5 @@ class SimpleDateTimeFormatTests(SimpleTestCase):
...
@@ -915,5 +915,5 @@ class SimpleDateTimeFormatTests(SimpleTestCase):
self
.
assertEqual
(
result
,
datetime
(
2010
,
12
,
21
,
13
,
30
))
self
.
assertEqual
(
result
,
datetime
(
2010
,
12
,
21
,
13
,
30
))
# Check that the parsed result does a round trip to default format
# Check that the parsed result does a round trip to default format
text
=
f
.
widget
.
_
format_value
(
result
)
text
=
f
.
widget
.
format_value
(
result
)
self
.
assertEqual
(
text
,
"2010-12-21 13:30:00"
)
self
.
assertEqual
(
text
,
"2010-12-21 13:30:00"
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment