mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 17:57:11 +00:00
Use new enums in mysensors tests (#62521)
This commit is contained in:
parent
e0c5cbf1e0
commit
03054bc430
@ -8,16 +8,13 @@ import pytest
|
|||||||
|
|
||||||
from homeassistant.components.sensor import (
|
from homeassistant.components.sensor import (
|
||||||
ATTR_STATE_CLASS,
|
ATTR_STATE_CLASS,
|
||||||
STATE_CLASS_MEASUREMENT,
|
SensorDeviceClass,
|
||||||
STATE_CLASS_TOTAL_INCREASING,
|
SensorStateClass,
|
||||||
)
|
)
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
ATTR_DEVICE_CLASS,
|
ATTR_DEVICE_CLASS,
|
||||||
ATTR_ICON,
|
ATTR_ICON,
|
||||||
ATTR_UNIT_OF_MEASUREMENT,
|
ATTR_UNIT_OF_MEASUREMENT,
|
||||||
DEVICE_CLASS_ENERGY,
|
|
||||||
DEVICE_CLASS_POWER,
|
|
||||||
DEVICE_CLASS_TEMPERATURE,
|
|
||||||
ENERGY_KILO_WATT_HOUR,
|
ENERGY_KILO_WATT_HOUR,
|
||||||
POWER_WATT,
|
POWER_WATT,
|
||||||
TEMP_CELSIUS,
|
TEMP_CELSIUS,
|
||||||
@ -71,9 +68,9 @@ async def test_power_sensor(
|
|||||||
|
|
||||||
assert state
|
assert state
|
||||||
assert state.state == "1200"
|
assert state.state == "1200"
|
||||||
assert state.attributes[ATTR_DEVICE_CLASS] == DEVICE_CLASS_POWER
|
assert state.attributes[ATTR_DEVICE_CLASS] == SensorDeviceClass.POWER
|
||||||
assert state.attributes[ATTR_UNIT_OF_MEASUREMENT] == POWER_WATT
|
assert state.attributes[ATTR_UNIT_OF_MEASUREMENT] == POWER_WATT
|
||||||
assert state.attributes[ATTR_STATE_CLASS] == STATE_CLASS_MEASUREMENT
|
assert state.attributes[ATTR_STATE_CLASS] is SensorStateClass.MEASUREMENT
|
||||||
|
|
||||||
|
|
||||||
async def test_energy_sensor(
|
async def test_energy_sensor(
|
||||||
@ -88,9 +85,9 @@ async def test_energy_sensor(
|
|||||||
|
|
||||||
assert state
|
assert state
|
||||||
assert state.state == "18000"
|
assert state.state == "18000"
|
||||||
assert state.attributes[ATTR_DEVICE_CLASS] == DEVICE_CLASS_ENERGY
|
assert state.attributes[ATTR_DEVICE_CLASS] == SensorDeviceClass.ENERGY
|
||||||
assert state.attributes[ATTR_UNIT_OF_MEASUREMENT] == ENERGY_KILO_WATT_HOUR
|
assert state.attributes[ATTR_UNIT_OF_MEASUREMENT] == ENERGY_KILO_WATT_HOUR
|
||||||
assert state.attributes[ATTR_STATE_CLASS] == STATE_CLASS_TOTAL_INCREASING
|
assert state.attributes[ATTR_STATE_CLASS] is SensorStateClass.TOTAL_INCREASING
|
||||||
|
|
||||||
|
|
||||||
async def test_sound_sensor(
|
async def test_sound_sensor(
|
||||||
@ -153,6 +150,6 @@ async def test_temperature_sensor(
|
|||||||
|
|
||||||
assert state
|
assert state
|
||||||
assert state.state == temperature
|
assert state.state == temperature
|
||||||
assert state.attributes[ATTR_DEVICE_CLASS] == DEVICE_CLASS_TEMPERATURE
|
assert state.attributes[ATTR_DEVICE_CLASS] == SensorDeviceClass.TEMPERATURE
|
||||||
assert state.attributes[ATTR_UNIT_OF_MEASUREMENT] == unit
|
assert state.attributes[ATTR_UNIT_OF_MEASUREMENT] == unit
|
||||||
assert state.attributes[ATTR_STATE_CLASS] == STATE_CLASS_MEASUREMENT
|
assert state.attributes[ATTR_STATE_CLASS] is SensorStateClass.MEASUREMENT
|
||||||
|
Loading…
x
Reference in New Issue
Block a user