Drop UNIT_ prefix for percentage constant (#39383)

This commit is contained in:
springstan 2020-09-05 21:09:14 +02:00 committed by GitHub
parent cdc93d7110
commit d2b1918e9c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
183 changed files with 639 additions and 661 deletions

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"