From 8683a30380e50c107825650b07032fac8fc7bd3d Mon Sep 17 00:00:00 2001 From: Robert Hillis Date: Fri, 17 Dec 2021 10:22:46 -0500 Subject: [PATCH] Use enums in utility_meter tests (#62190) * Use enums in utility_meter tests * uno mas --- tests/components/utility_meter/test_sensor.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/components/utility_meter/test_sensor.py b/tests/components/utility_meter/test_sensor.py index 8d9b819f610..51212580aaf 100644 --- a/tests/components/utility_meter/test_sensor.py +++ b/tests/components/utility_meter/test_sensor.py @@ -5,8 +5,8 @@ from unittest.mock import patch from homeassistant.components.sensor import ( ATTR_STATE_CLASS, - STATE_CLASS_TOTAL, - STATE_CLASS_TOTAL_INCREASING, + SensorDeviceClass, + SensorStateClass, ) from homeassistant.components.utility_meter.const import ( ATTR_TARIFF, @@ -269,15 +269,15 @@ async def test_device_class(hass): state = hass.states.get("sensor.energy_meter") assert state is not None assert state.state == "0" - assert state.attributes.get(ATTR_DEVICE_CLASS) == "energy" - assert state.attributes.get(ATTR_STATE_CLASS) == STATE_CLASS_TOTAL + assert state.attributes.get(ATTR_DEVICE_CLASS) is SensorDeviceClass.ENERGY.value + assert state.attributes.get(ATTR_STATE_CLASS) is SensorStateClass.TOTAL assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == ENERGY_KILO_WATT_HOUR state = hass.states.get("sensor.gas_meter") assert state is not None assert state.state == "0" assert state.attributes.get(ATTR_DEVICE_CLASS) is None - assert state.attributes.get(ATTR_STATE_CLASS) == STATE_CLASS_TOTAL_INCREASING + assert state.attributes.get(ATTR_STATE_CLASS) is SensorStateClass.TOTAL_INCREASING assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == "some_archaic_unit"