Add and use percentage constant (#32094)

* Add and use percentage constant

* Fix pylint error and broken test
This commit is contained in:
springstan authored and GitHub committed 2020-02-28 11:46:48 -08:00
1 parent c7f128f286
commit f1a0ca7cd3
155 files changed
+735 -459

No files matched your search

+3 -2
View File
@@ -12,6 +12,7 @@ from homeassistant.components.canary.sensor import (
STATE_AIR_QUALITY_VERY_ABNORMAL,
CanarySensor,
)
from homeassistant.const import UNIT_PERCENTAGE
from tests.common import get_test_home_assistant
from tests.components.canary.test_init import mock_device, mock_location
@@ -97,7 +98,7 @@ class TestCanarySensorSetup(unittest.TestCase):
sensor.update()
assert "Home Family Room Humidity" == sensor.name
assert "%" == sensor.unit_of_measurement
assert UNIT_PERCENTAGE == sensor.unit_of_measurement
assert 50.46 == sensor.state
assert "mdi:water-percent" == sensor.icon
@@ -184,7 +185,7 @@ class TestCanarySensorSetup(unittest.TestCase):
sensor.update()
assert "Home Family Room Battery" == sensor.name
assert "%" == sensor.unit_of_measurement
assert UNIT_PERCENTAGE == sensor.unit_of_measurement
assert 70.46 == sensor.state
assert "mdi:battery-70" == sensor.icon