Replace the usage of unit constants by enumerations in Tests [a-e] (#85932)

This commit is contained in:
Michael 2023-01-15 14:44:01 +01:00 committed by GitHub
parent b20eb54800
commit 2850583085
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 164 additions and 122 deletions

View file

@ -11,7 +11,7 @@ from homeassistant.const import (
ATTR_LATITUDE,
ATTR_LONGITUDE,
ATTR_UNIT_OF_MEASUREMENT,
LENGTH_KILOMETERS,
UnitOfLength,
)
from homeassistant.setup import async_setup_component
import homeassistant.util.dt as dt_util
@ -45,7 +45,7 @@ async def test_setup_platform(hass):
continue
assert abs(state.attributes[ATTR_LATITUDE] - hass.config.latitude) < 1.0
assert abs(state.attributes[ATTR_LONGITUDE] - hass.config.longitude) < 1.0
assert state.attributes[ATTR_UNIT_OF_MEASUREMENT] == LENGTH_KILOMETERS
assert state.attributes[ATTR_UNIT_OF_MEASUREMENT] == UnitOfLength.KILOMETERS
# Update (replaces 1 device).
async_fire_time_changed(hass, utcnow + DEFAULT_UPDATE_INTERVAL)