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