Fix dangerous-default-value in zha tests (#119560)

This commit is contained in:
epenet 2024-06-13 08:35:05 +02:00 committed by GitHub
parent dda6ccccd2
commit 669569ca49
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 11 additions and 7 deletions

View file

@ -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] = {

View file

@ -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."""

View file

@ -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."""