Test for TimeField not handling empty values

This commit is contained in:
areski 2016-01-11 12:16:26 +01:00
parent a76c3ed051
commit 4e01796303
2 changed files with 2 additions and 1 deletions

View File

@ -1204,7 +1204,7 @@ class TimeField(Field):
)
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()
return value.isoformat()
return value.strftime(output_format)

View File

@ -1032,6 +1032,7 @@ class TestTimeField(FieldValues):
}
outputs = {
datetime.time(13, 00): '13:00:00',
'00:00:00': '00:00:00',
None: None,
'': None,
}