mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-01-24 16:24:18 +03:00
Test for TimeField not handling empty values
This commit is contained in:
parent
a76c3ed051
commit
4e01796303
|
@ -1204,7 +1204,7 @@ class TimeField(Field):
|
||||||
)
|
)
|
||||||
|
|
||||||
if output_format.lower() == ISO_8601:
|
if output_format.lower() == ISO_8601:
|
||||||
if (isinstance(value, str)):
|
if isinstance(value, six.string_types):
|
||||||
value = datetime.datetime.strptime(value, '%H:%M:%S').time()
|
value = datetime.datetime.strptime(value, '%H:%M:%S').time()
|
||||||
return value.isoformat()
|
return value.isoformat()
|
||||||
return value.strftime(output_format)
|
return value.strftime(output_format)
|
||||||
|
|
|
@ -1032,6 +1032,7 @@ class TestTimeField(FieldValues):
|
||||||
}
|
}
|
||||||
outputs = {
|
outputs = {
|
||||||
datetime.time(13, 00): '13:00:00',
|
datetime.time(13, 00): '13:00:00',
|
||||||
|
'00:00:00': '00:00:00',
|
||||||
None: None,
|
None: None,
|
||||||
'': None,
|
'': None,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user