Add some tests for number and sensor platform

This commit is contained in:
Joakim Plate
2024-01-08 19:36:08 +01:00
parent 398c9c8116
commit 78d31bc063
2 changed files with 34 additions and 0 deletions

View File

@@ -32,6 +32,7 @@ from homeassistant.const import (
ATTR_UNIT_OF_MEASUREMENT, ATTR_UNIT_OF_MEASUREMENT,
CONF_PLATFORM, CONF_PLATFORM,
UnitOfTemperature, UnitOfTemperature,
UnitOfVolumeFlowRate,
) )
from homeassistant.core import HomeAssistant, State from homeassistant.core import HomeAssistant, State
from homeassistant.helpers import entity_registry as er from homeassistant.helpers import entity_registry as er
@@ -686,6 +687,22 @@ async def test_restore_number_restore_state(
100, 100,
38.0, 38.0,
), ),
(
SensorDeviceClass.VOLUME_FLOW_RATE,
UnitOfVolumeFlowRate.LITERS_PER_MINUTE,
UnitOfVolumeFlowRate.GALLONS_PER_MINUTE,
UnitOfVolumeFlowRate.GALLONS_PER_MINUTE,
50.0,
"13.2",
),
(
SensorDeviceClass.VOLUME_FLOW_RATE,
UnitOfVolumeFlowRate.GALLONS_PER_MINUTE,
UnitOfVolumeFlowRate.LITERS_PER_MINUTE,
UnitOfVolumeFlowRate.LITERS_PER_MINUTE,
13.0,
"49.2",
),
], ],
) )
async def test_custom_unit( async def test_custom_unit(

View File

@@ -36,6 +36,7 @@ from homeassistant.const import (
UnitOfSpeed, UnitOfSpeed,
UnitOfTemperature, UnitOfTemperature,
UnitOfVolume, UnitOfVolume,
UnitOfVolumeFlowRate,
UnitOfVolumetricFlux, UnitOfVolumetricFlux,
) )
from homeassistant.core import HomeAssistant, State from homeassistant.core import HomeAssistant, State
@@ -581,6 +582,22 @@ async def test_restore_sensor_restore_state(
-0.00001, -0.00001,
"0", "0",
), ),
(
SensorDeviceClass.VOLUME_FLOW_RATE,
UnitOfVolumeFlowRate.LITERS_PER_MINUTE,
UnitOfVolumeFlowRate.GALLONS_PER_MINUTE,
UnitOfVolumeFlowRate.GALLONS_PER_MINUTE,
50.0,
"13.2",
),
(
SensorDeviceClass.VOLUME_FLOW_RATE,
UnitOfVolumeFlowRate.GALLONS_PER_MINUTE,
UnitOfVolumeFlowRate.LITERS_PER_MINUTE,
UnitOfVolumeFlowRate.LITERS_PER_MINUTE,
13.0,
"49.2",
),
], ],
) )
async def test_custom_unit( async def test_custom_unit(