1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 12:59:34 +00:00

Add and use percentage constant (#32094)

* Add and use percentage constant

* Fix pylint error and broken test
This commit is contained in:
springstan
2020-02-28 20:46:48 +01:00
committed by GitHub
parent c7f128f286
commit f1a0ca7cd3
155 changed files with 735 additions and 459 deletions

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