Fix dangerous-default-value in zha tests (#119560)
parent
dda6ccccd2
commit
669569ca49
|
@ -520,10 +520,10 @@ def network_backup() -> zigpy.backups.NetworkBackup:
|
|||
|
||||
|
||||
@pytest.fixture
|
||||
def core_rs(hass_storage: dict[str, Any]):
|
||||
def core_rs(hass_storage: dict[str, Any]) -> Callable[[str, Any, dict[str, Any]], None]:
|
||||
"""Core.restore_state fixture."""
|
||||
|
||||
def _storage(entity_id, state, attributes={}):
|
||||
def _storage(entity_id: str, state: str, attributes: dict[str, Any]) -> None:
|
||||
now = dt_util.utcnow().isoformat()
|
||||
|
||||
hass_storage[restore_state.STORAGE_KEY] = {
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
"""Test ZHA binary sensor."""
|
||||
|
||||
from collections.abc import Callable
|
||||
from typing import Any
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
|
@ -158,9 +160,9 @@ async def test_binary_sensor(
|
|||
async def test_onoff_binary_sensor_restore_state(
|
||||
hass: HomeAssistant,
|
||||
zigpy_device_mock,
|
||||
core_rs,
|
||||
core_rs: Callable[[str, Any, dict[str, Any]], None],
|
||||
zha_device_restored,
|
||||
restored_state,
|
||||
restored_state: str,
|
||||
) -> None:
|
||||
"""Test ZHA OnOff binary_sensor restores last state from HA."""
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
"""Test ZHA light."""
|
||||
|
||||
from collections.abc import Callable
|
||||
from datetime import timedelta
|
||||
from typing import Any
|
||||
from unittest.mock import AsyncMock, call, patch, sentinel
|
||||
|
||||
import pytest
|
||||
|
@ -1962,10 +1964,10 @@ async def test_group_member_assume_state(
|
|||
async def test_restore_light_state(
|
||||
hass: HomeAssistant,
|
||||
zigpy_device_mock,
|
||||
core_rs,
|
||||
core_rs: Callable[[str, Any, dict[str, Any]], None],
|
||||
zha_device_restored,
|
||||
restored_state,
|
||||
expected_state,
|
||||
restored_state: str,
|
||||
expected_state: dict[str, Any],
|
||||
) -> None:
|
||||
"""Test ZHA light restores without throwing an error when attributes are None."""
|
||||
|
||||
|
|
Loading…
Reference in New Issue