diff --git a/bumblebee_status/util/format.py b/bumblebee_status/util/format.py index 198e995..65242a3 100644 --- a/bumblebee_status/util/format.py +++ b/bumblebee_status/util/format.py @@ -68,7 +68,7 @@ def astemperature(val, unit="metric"): :return: temperature representation of the input value :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}"): diff --git a/tests/util/test_format.py b/tests/util/test_format.py index 4dda6e9..1e34dec 100644 --- a/tests/util/test_format.py +++ b/tests/util/test_format.py @@ -110,4 +110,7 @@ def test_temperature(): assert astemperature(-100, "kelvin") == "-100°K" +def test_temperature_case(): + assert astemperature(100, "ImPeRiAl") == "100°F" + # vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4