From 78d31bc06332c7d67a15673e46f2d69ddb4fab69 Mon Sep 17 00:00:00 2001 From: Joakim Plate Date: Mon, 8 Jan 2024 19:36:08 +0100 Subject: [PATCH] Add some tests for number and sensor platform --- tests/components/number/test_init.py | 17 +++++++++++++++++ tests/components/sensor/test_init.py | 17 +++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/tests/components/number/test_init.py b/tests/components/number/test_init.py index 4de47b9b844..9c66b45df25 100644 --- a/tests/components/number/test_init.py +++ b/tests/components/number/test_init.py @@ -32,6 +32,7 @@ from homeassistant.const import ( ATTR_UNIT_OF_MEASUREMENT, CONF_PLATFORM, UnitOfTemperature, + UnitOfVolumeFlowRate, ) from homeassistant.core import HomeAssistant, State from homeassistant.helpers import entity_registry as er @@ -686,6 +687,22 @@ async def test_restore_number_restore_state( 100, 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( diff --git a/tests/components/sensor/test_init.py b/tests/components/sensor/test_init.py index 522afe3b992..11d8ae818d6 100644 --- a/tests/components/sensor/test_init.py +++ b/tests/components/sensor/test_init.py @@ -36,6 +36,7 @@ from homeassistant.const import ( UnitOfSpeed, UnitOfTemperature, UnitOfVolume, + UnitOfVolumeFlowRate, UnitOfVolumetricFlux, ) from homeassistant.core import HomeAssistant, State @@ -581,6 +582,22 @@ async def test_restore_sensor_restore_state( -0.00001, "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(