parent
1484109fe0
commit
954d7545e3
2 changed files with 4 additions and 1 deletions
|
@ -68,7 +68,7 @@ def astemperature(val, unit="metric"):
|
||||||
:return: temperature representation of the input value
|
:return: temperature representation of the input value
|
||||||
:rtype: string
|
:rtype: string
|
||||||
"""
|
"""
|
||||||
return "{}°{}".format(int(val), __UNITS.get(unit, __UNITS["default"]))
|
return "{}°{}".format(int(val), __UNITS.get(unit.lower(), __UNITS["default"]))
|
||||||
|
|
||||||
|
|
||||||
def byte(val, fmt="{:.2f}"):
|
def byte(val, fmt="{:.2f}"):
|
||||||
|
|
|
@ -110,4 +110,7 @@ def test_temperature():
|
||||||
assert astemperature(-100, "kelvin") == "-100°K"
|
assert astemperature(-100, "kelvin") == "-100°K"
|
||||||
|
|
||||||
|
|
||||||
|
def test_temperature_case():
|
||||||
|
assert astemperature(100, "ImPeRiAl") == "100°F"
|
||||||
|
|
||||||
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
|
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
|
||||||
|
|
Loading…
Reference in a new issue