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

+6 -6
View File
@@ -2,7 +2,7 @@
import logging
from homeassistant.const import STATE_UNKNOWN, UNIT_PERCENTAGE
from homeassistant.const import PERCENTAGE, STATE_UNKNOWN
from homeassistant.helpers import device_registry
_LOGGER = logging.getLogger(__name__)
@@ -25,7 +25,7 @@ async def test_sensor(hass, create_registrations, webhook_client):
"state": 100,
"type": "sensor",
"unique_id": "battery_state",
"unit_of_measurement": UNIT_PERCENTAGE,
"unit_of_measurement": PERCENTAGE,
},
},
)
@@ -41,7 +41,7 @@ async def test_sensor(hass, create_registrations, webhook_client):
assert entity.attributes["device_class"] == "battery"
assert entity.attributes["icon"] == "mdi:battery"
assert entity.attributes["unit_of_measurement"] == UNIT_PERCENTAGE
assert entity.attributes["unit_of_measurement"] == PERCENTAGE
assert entity.attributes["foo"] == "bar"
assert entity.domain == "sensor"
assert entity.name == "Test 1 Battery State"
@@ -110,7 +110,7 @@ async def test_sensor_id_no_dupes(hass, create_registrations, webhook_client, ca
"state": 100,
"type": "sensor",
"unique_id": "battery_state",
"unit_of_measurement": UNIT_PERCENTAGE,
"unit_of_measurement": PERCENTAGE,
},
}
@@ -129,7 +129,7 @@ async def test_sensor_id_no_dupes(hass, create_registrations, webhook_client, ca
assert entity.attributes["device_class"] == "battery"
assert entity.attributes["icon"] == "mdi:battery"
assert entity.attributes["unit_of_measurement"] == UNIT_PERCENTAGE
assert entity.attributes["unit_of_measurement"] == PERCENTAGE
assert entity.attributes["foo"] == "bar"
assert entity.domain == "sensor"
assert entity.name == "Test 1 Battery State"
@@ -150,7 +150,7 @@ async def test_sensor_id_no_dupes(hass, create_registrations, webhook_client, ca
assert entity.attributes["device_class"] == "battery"
assert entity.attributes["icon"] == "mdi:battery"
assert entity.attributes["unit_of_measurement"] == UNIT_PERCENTAGE
assert entity.attributes["unit_of_measurement"] == PERCENTAGE
assert entity.attributes["foo"] == "bar"
assert entity.domain == "sensor"
assert entity.name == "Test 1 Battery State"