mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +00:00
Add missing test for Apparent temperature in Weather component (#95080)
This commit is contained in:
parent
eafddaae83
commit
893b74d77e
@ -229,14 +229,17 @@ async def test_temperature_no_unit(
|
|||||||
hass.config.units = unit_system
|
hass.config.units = unit_system
|
||||||
native_value = 38
|
native_value = 38
|
||||||
dew_point_native_value = 32
|
dew_point_native_value = 32
|
||||||
|
apparent_temp_native_value = 45
|
||||||
state_value = native_value
|
state_value = native_value
|
||||||
dew_point_state_value = dew_point_native_value
|
dew_point_state_value = dew_point_native_value
|
||||||
|
apparent_temp_state_value = apparent_temp_native_value
|
||||||
|
|
||||||
entity0 = await create_entity(
|
entity0 = await create_entity(
|
||||||
hass,
|
hass,
|
||||||
native_temperature=native_value,
|
native_temperature=native_value,
|
||||||
native_temperature_unit=native_unit,
|
native_temperature_unit=native_unit,
|
||||||
native_dew_point=dew_point_native_value,
|
native_dew_point=dew_point_native_value,
|
||||||
|
native_apparent_temperature=apparent_temp_native_value,
|
||||||
)
|
)
|
||||||
|
|
||||||
state = hass.states.get(entity0.entity_id)
|
state = hass.states.get(entity0.entity_id)
|
||||||
@ -244,18 +247,25 @@ async def test_temperature_no_unit(
|
|||||||
|
|
||||||
expected = state_value
|
expected = state_value
|
||||||
dew_point_expected = dew_point_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(
|
assert float(state.attributes[ATTR_WEATHER_TEMPERATURE]) == pytest.approx(
|
||||||
expected, rel=0.1
|
expected, rel=0.1
|
||||||
)
|
)
|
||||||
assert float(state.attributes[ATTR_WEATHER_DEW_POINT]) == pytest.approx(
|
assert float(state.attributes[ATTR_WEATHER_DEW_POINT]) == pytest.approx(
|
||||||
dew_point_expected, rel=0.1
|
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 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_TEMP]) == pytest.approx(expected, rel=0.1)
|
||||||
assert float(forecast[ATTR_FORECAST_DEW_POINT]) == pytest.approx(
|
assert float(forecast[ATTR_FORECAST_DEW_POINT]) == pytest.approx(
|
||||||
dew_point_expected, rel=0.1
|
dew_point_expected, rel=0.1
|
||||||
)
|
)
|
||||||
assert float(forecast[ATTR_FORECAST_TEMP_LOW]) == pytest.approx(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))
|
@pytest.mark.parametrize("native_unit", (UnitOfPressure.INHG, UnitOfPressure.INHG))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user