diff --git a/homeassistant/components/zha/core/decorators.py b/homeassistant/components/zha/core/decorators.py index c57cad7d65e..5cf9322170f 100644 --- a/homeassistant/components/zha/core/decorators.py +++ b/homeassistant/components/zha/core/decorators.py @@ -2,12 +2,12 @@ from __future__ import annotations from collections.abc import Callable -from typing import Any, TypeVar, Union +from typing import Any, TypeVar _TypeT = TypeVar("_TypeT", bound=type[Any]) -class DictRegistry(dict[Union[int, str], _TypeT]): +class DictRegistry(dict[int | str, _TypeT]): """Dict Registry of items.""" def register(self, name: int | str) -> Callable[[_TypeT], _TypeT]: @@ -21,7 +21,7 @@ class DictRegistry(dict[Union[int, str], _TypeT]): return decorator -class SetRegistry(set[Union[int, str]]): +class SetRegistry(set[int | str]): """Set Registry of items.""" def register(self, name: int | str) -> Callable[[_TypeT], _TypeT]: diff --git a/homeassistant/components/zha/core/gateway.py b/homeassistant/components/zha/core/gateway.py index ffd005e8edc..5b04c623306 100644 --- a/homeassistant/components/zha/core/gateway.py +++ b/homeassistant/components/zha/core/gateway.py @@ -11,7 +11,7 @@ import logging import re import time import traceback -from typing import TYPE_CHECKING, Any, NamedTuple, Union +from typing import TYPE_CHECKING, Any, NamedTuple from zigpy.application import ControllerApplication from zigpy.config import CONF_DEVICE @@ -91,7 +91,7 @@ if TYPE_CHECKING: from ..entity import ZhaEntity from .channels.base import ZigbeeChannel - _LogFilterType = Union[Filter, Callable[[LogRecord], int]] + _LogFilterType = Filter | Callable[[LogRecord], int] _LOGGER = logging.getLogger(__name__) diff --git a/tests/components/zha/test_device.py b/tests/components/zha/test_device.py index eca9adbc6d8..eef7953b6d2 100644 --- a/tests/components/zha/test_device.py +++ b/tests/components/zha/test_device.py @@ -1,5 +1,6 @@ """Test ZHA device switch.""" from datetime import timedelta +import logging import time from unittest import mock from unittest.mock import patch @@ -224,6 +225,7 @@ async def test_check_available_no_basic_channel( hass, device_without_basic_channel, zha_device_restored, caplog ): """Check device availability for a device without basic cluster.""" + caplog.set_level(logging.DEBUG, logger="homeassistant.components.zha") zha_device = await zha_device_restored(device_without_basic_channel) await async_enable_traffic(hass, [zha_device])