Use DeviceClass Enums in filter tests (#62138)
parent
7fe895e554
commit
b01078199a
|
@ -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"
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue