Use DeviceClass Enums in filter tests (#62138)

pull/62312/head
Dave T 2021-12-19 12:01:54 +00:00 committed by GitHub
parent 7fe895e554
commit b01078199a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 6 deletions

View File

@ -16,8 +16,8 @@ from homeassistant.components.filter.sensor import (
) )
from homeassistant.components.sensor import ( from homeassistant.components.sensor import (
ATTR_STATE_CLASS, ATTR_STATE_CLASS,
DEVICE_CLASS_TEMPERATURE, SensorDeviceClass,
STATE_CLASS_TOTAL_INCREASING, SensorStateClass,
) )
from homeassistant.const import ( from homeassistant.const import (
ATTR_DEVICE_CLASS, ATTR_DEVICE_CLASS,
@ -274,15 +274,15 @@ async def test_setup(hass):
1, 1,
{ {
"icon": "mdi:test", "icon": "mdi:test",
ATTR_DEVICE_CLASS: DEVICE_CLASS_TEMPERATURE, ATTR_DEVICE_CLASS: SensorDeviceClass.TEMPERATURE,
ATTR_STATE_CLASS: STATE_CLASS_TOTAL_INCREASING, ATTR_STATE_CLASS: SensorStateClass.TOTAL_INCREASING,
}, },
) )
await hass.async_block_till_done() await hass.async_block_till_done()
state = hass.states.get("sensor.test") state = hass.states.get("sensor.test")
assert state.attributes["icon"] == "mdi:test" assert state.attributes["icon"] == "mdi:test"
assert state.attributes[ATTR_DEVICE_CLASS] == DEVICE_CLASS_TEMPERATURE assert state.attributes[ATTR_DEVICE_CLASS] == SensorDeviceClass.TEMPERATURE
assert state.attributes[ATTR_STATE_CLASS] == STATE_CLASS_TOTAL_INCREASING assert state.attributes[ATTR_STATE_CLASS] is SensorStateClass.TOTAL_INCREASING
assert state.state == "1.0" assert state.state == "1.0"