From 893b74d77eb3958bdbb729f6ae0a07bbce8e913d Mon Sep 17 00:00:00 2001 From: G Johansson Date: Thu, 22 Jun 2023 23:19:51 +0200 Subject: [PATCH] Add missing test for Apparent temperature in Weather component (#95080) --- tests/components/weather/test_init.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/components/weather/test_init.py b/tests/components/weather/test_init.py index bdabc7e9c08..af2e1a5d6cb 100644 --- a/tests/components/weather/test_init.py +++ b/tests/components/weather/test_init.py @@ -229,14 +229,17 @@ async def test_temperature_no_unit( hass.config.units = unit_system native_value = 38 dew_point_native_value = 32 + apparent_temp_native_value = 45 state_value = native_value dew_point_state_value = dew_point_native_value + apparent_temp_state_value = apparent_temp_native_value entity0 = await create_entity( hass, native_temperature=native_value, native_temperature_unit=native_unit, native_dew_point=dew_point_native_value, + native_apparent_temperature=apparent_temp_native_value, ) state = hass.states.get(entity0.entity_id) @@ -244,18 +247,25 @@ async def test_temperature_no_unit( expected = state_value dew_point_expected = dew_point_state_value + expected_apparent_temp = apparent_temp_state_value assert float(state.attributes[ATTR_WEATHER_TEMPERATURE]) == pytest.approx( expected, rel=0.1 ) assert float(state.attributes[ATTR_WEATHER_DEW_POINT]) == pytest.approx( dew_point_expected, rel=0.1 ) + assert float(state.attributes[ATTR_WEATHER_APPARENT_TEMPERATURE]) == pytest.approx( + expected_apparent_temp, rel=0.1 + ) assert state.attributes[ATTR_WEATHER_TEMPERATURE_UNIT] == state_unit assert float(forecast[ATTR_FORECAST_TEMP]) == pytest.approx(expected, rel=0.1) assert float(forecast[ATTR_FORECAST_DEW_POINT]) == pytest.approx( dew_point_expected, rel=0.1 ) assert float(forecast[ATTR_FORECAST_TEMP_LOW]) == pytest.approx(expected, rel=0.1) + assert float(forecast[ATTR_FORECAST_APPARENT_TEMP]) == pytest.approx( + expected_apparent_temp, rel=0.1 + ) @pytest.mark.parametrize("native_unit", (UnitOfPressure.INHG, UnitOfPressure.INHG))