mirrors: silence flake8 E721
This commit is contained in:
parent
9e4df5f0f3
commit
6883cbea24
@ -6,7 +6,7 @@
|
||||
|
||||
@register.filter
|
||||
def duration(value):
|
||||
if not value and type(value) != timedelta:
|
||||
if not value or not isinstance(value, timedelta):
|
||||
return u''
|
||||
# does not take microseconds into account
|
||||
total_secs = value.seconds + value.days * 24 * 3600
|
||||
@ -17,7 +17,7 @@ def duration(value):
|
||||
|
||||
@register.filter
|
||||
def hours(value):
|
||||
if not value and type(value) != timedelta:
|
||||
if not value or not isinstance(value, timedelta):
|
||||
return u''
|
||||
# does not take microseconds into account
|
||||
total_secs = value.seconds + value.days * 24 * 3600
|
||||
@ -30,7 +30,7 @@ def hours(value):
|
||||
|
||||
@register.filter
|
||||
def percentage(value, arg=1):
|
||||
if not value and type(value) != float:
|
||||
if not value or not isinstance(value, float):
|
||||
return u''
|
||||
new_val = value * 100.0
|
||||
return '%.*f%%' % (arg, new_val)
|
||||
|
@ -22,5 +22,5 @@ def test_hours():
|
||||
|
||||
def test_percentage():
|
||||
assert percentage(None) == ''
|
||||
assert percentage(10) == '1000.0%'
|
||||
assert percentage(10, 2) == '1000.00%'
|
||||
assert percentage(10.0) == '1000.0%'
|
||||
assert percentage(10.0, 2) == '1000.00%'
|
||||
|
Loading…
Reference in New Issue
Block a user