Use UNIT_PERCENTAGE constant (#34054)

This commit is contained in:
springstan 2020-04-11 22:53:48 +02:00 committed by GitHub
parent 4f50b858d0
commit 9f713dac7f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 27 additions and 19 deletions

View file

@ -7,6 +7,7 @@ from homeassistant.const import (
ATTR_UNIT_OF_MEASUREMENT,
DEVICE_CLASS_HUMIDITY,
TEMP_CELSIUS,
UNIT_PERCENTAGE,
)
from .common import setup_platform
@ -31,7 +32,7 @@ async def test_attributes(hass):
assert not state.attributes.get("battery_low")
assert not state.attributes.get("no_response")
assert state.attributes.get("device_type") == "LM"
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == "%"
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == UNIT_PERCENTAGE
assert state.attributes.get(ATTR_FRIENDLY_NAME) == "Environment Sensor Humidity"
assert state.attributes.get(ATTR_DEVICE_CLASS) == DEVICE_CLASS_HUMIDITY