Drop use of deprecated constant in zha tests (#119397)

This commit is contained in:
epenet 2024-06-11 16:09:53 +02:00 committed by GitHub
parent 68a84c365d
commit 50356aa877
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,5 +1,6 @@
"""Test ZHA sensor.""" """Test ZHA sensor."""
from collections.abc import Callable
from datetime import timedelta from datetime import timedelta
import math import math
from typing import Any from typing import Any
@ -23,8 +24,6 @@ from homeassistant.const import (
ATTR_DEVICE_CLASS, ATTR_DEVICE_CLASS,
ATTR_UNIT_OF_MEASUREMENT, ATTR_UNIT_OF_MEASUREMENT,
CONF_UNIT_SYSTEM, CONF_UNIT_SYSTEM,
CONF_UNIT_SYSTEM_IMPERIAL,
CONF_UNIT_SYSTEM_METRIC,
LIGHT_LUX, LIGHT_LUX,
PERCENTAGE, PERCENTAGE,
STATE_UNAVAILABLE, STATE_UNAVAILABLE,
@ -633,10 +632,10 @@ def assert_state(hass: HomeAssistant, entity_id, state, unit_of_measurement):
@pytest.fixture @pytest.fixture
def hass_ms(hass: HomeAssistant): def hass_ms(hass: HomeAssistant) -> Callable[[str], HomeAssistant]:
"""Hass instance with measurement system.""" """Hass instance with measurement system."""
async def _hass_ms(meas_sys): async def _hass_ms(meas_sys: str) -> HomeAssistant:
await config_util.async_process_ha_core_config( await config_util.async_process_ha_core_config(
hass, {CONF_UNIT_SYSTEM: meas_sys} hass, {CONF_UNIT_SYSTEM: meas_sys}
) )
@ -688,11 +687,11 @@ def core_rs(hass_storage: dict[str, Any]):
) )
async def test_temp_uom( async def test_temp_uom(
hass: HomeAssistant, hass: HomeAssistant,
uom, uom: UnitOfTemperature,
raw_temp, raw_temp: int,
expected, expected: int,
restore, restore: bool,
hass_ms, hass_ms: Callable[[str], HomeAssistant],
core_rs, core_rs,
zigpy_device_mock, zigpy_device_mock,
zha_device_restored, zha_device_restored,
@ -704,11 +703,7 @@ async def test_temp_uom(
core_rs(entity_id, uom, state=(expected - 2)) core_rs(entity_id, uom, state=(expected - 2))
await async_mock_load_restore_state_from_storage(hass) await async_mock_load_restore_state_from_storage(hass)
hass = await hass_ms( hass = await hass_ms("metric" if uom == UnitOfTemperature.CELSIUS else "imperial")
CONF_UNIT_SYSTEM_METRIC
if uom == UnitOfTemperature.CELSIUS
else CONF_UNIT_SYSTEM_IMPERIAL
)
zigpy_device = zigpy_device_mock( zigpy_device = zigpy_device_mock(
{ {