Drop UNIT_ prefix for percentage constant (#39383)

This commit is contained in:
springstan authored and GitHub committed 2020-09-05 21:09:14 +02:00
1 parent cdc93d7110
commit d2b1918e9c
183 files changed
+639 -661

No files matched your search

+7 -10
View File
@@ -1,6 +1,6 @@
"""The sensor tests for the august platform."""
from homeassistant.const import STATE_UNAVAILABLE, UNIT_PERCENTAGE
from homeassistant.const import PERCENTAGE, STATE_UNAVAILABLE
from tests.components.august.mocks import (
_create_august_with_devices,
@@ -21,8 +21,7 @@ async def test_create_doorbell(hass):
)
assert sensor_k98gidt45gul_name_battery.state == "96"
assert (
sensor_k98gidt45gul_name_battery.attributes["unit_of_measurement"]
== UNIT_PERCENTAGE
sensor_k98gidt45gul_name_battery.attributes["unit_of_measurement"] == PERCENTAGE
)
@@ -34,9 +33,7 @@ async def test_create_doorbell_offline(hass):
sensor_tmt100_name_battery = hass.states.get("sensor.tmt100_name_battery")
assert sensor_tmt100_name_battery.state == "81"
assert (
sensor_tmt100_name_battery.attributes["unit_of_measurement"] == UNIT_PERCENTAGE
)
assert sensor_tmt100_name_battery.attributes["unit_of_measurement"] == PERCENTAGE
entry = entity_registry.async_get("sensor.tmt100_name_battery")
assert entry
@@ -68,7 +65,7 @@ async def test_create_lock_with_linked_keypad(hass):
sensor_a6697750d607098bae8d6baa11ef8063_name_battery.attributes[
"unit_of_measurement"
]
== UNIT_PERCENTAGE
== PERCENTAGE
)
entry = entity_registry.async_get(
"sensor.a6697750d607098bae8d6baa11ef8063_name_battery"
@@ -78,7 +75,7 @@ async def test_create_lock_with_linked_keypad(hass):
state = hass.states.get("sensor.front_door_lock_keypad_battery")
assert state.state == "60"
assert state.attributes["unit_of_measurement"] == UNIT_PERCENTAGE
assert state.attributes["unit_of_measurement"] == PERCENTAGE
entry = entity_registry.async_get("sensor.front_door_lock_keypad_battery")
assert entry
assert entry.unique_id == "5bc65c24e6ef2a263e1450a8_linked_keypad_battery"
@@ -98,7 +95,7 @@ async def test_create_lock_with_low_battery_linked_keypad(hass):
sensor_a6697750d607098bae8d6baa11ef8063_name_battery.attributes[
"unit_of_measurement"
]
== UNIT_PERCENTAGE
== PERCENTAGE
)
entry = entity_registry.async_get(
"sensor.a6697750d607098bae8d6baa11ef8063_name_battery"
@@ -108,7 +105,7 @@ async def test_create_lock_with_low_battery_linked_keypad(hass):
state = hass.states.get("sensor.front_door_lock_keypad_battery")
assert state.state == "10"
assert state.attributes["unit_of_measurement"] == UNIT_PERCENTAGE
assert state.attributes["unit_of_measurement"] == PERCENTAGE
entry = entity_registry.async_get("sensor.front_door_lock_keypad_battery")
assert entry
assert entry.unique_id == "5bc65c24e6ef2a263e1450a8_linked_keypad_battery"