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

+8 -3
View File
@@ -12,7 +12,7 @@ from homeassistant.components.rflink import (
EVENT_KEY_SENSOR,
TMP_ENTITY,
)
from homeassistant.const import STATE_UNKNOWN
from homeassistant.const import STATE_UNKNOWN, UNIT_PERCENTAGE
from tests.components.rflink.test_init import mock_rflink
@@ -141,7 +141,12 @@ async def test_aliases(hass, monkeypatch):
# test event for config sensor
event_callback(
{"id": "test_alias_02_0", "sensor": "humidity", "value": 65, "unit": "%"}
{
"id": "test_alias_02_0",
"sensor": "humidity",
"value": 65,
"unit": UNIT_PERCENTAGE,
}
)
await hass.async_block_till_done()
@@ -149,7 +154,7 @@ async def test_aliases(hass, monkeypatch):
updated_sensor = hass.states.get("sensor.test_02")
assert updated_sensor
assert updated_sensor.state == "65"
assert updated_sensor.attributes["unit_of_measurement"] == "%"
assert updated_sensor.attributes["unit_of_measurement"] == UNIT_PERCENTAGE
async def test_race_condition(hass, monkeypatch):