Fix implicit-return rule in zha tests (#122772)

This commit is contained in:
epenet 2024-07-29 15:22:08 +02:00 committed by GitHub
parent d94e79d57a
commit 9514a38320
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -6,6 +6,7 @@ from unittest.mock import AsyncMock, Mock
import zigpy.zcl import zigpy.zcl
import zigpy.zcl.foundation as zcl_f import zigpy.zcl.foundation as zcl_f
from homeassistant.components.zha.helpers import ZHADeviceProxy
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
from homeassistant.helpers import entity_registry as er from homeassistant.helpers import entity_registry as er
import homeassistant.util.dt as dt_util import homeassistant.util.dt as dt_util
@ -123,7 +124,9 @@ async def send_attributes_report(
await hass.async_block_till_done() await hass.async_block_till_done()
def find_entity_id(domain, zha_device, hass: HomeAssistant, qualifier=None): def find_entity_id(
domain: str, zha_device: ZHADeviceProxy, hass: HomeAssistant, qualifier=None
) -> str | None:
"""Find the entity id under the testing. """Find the entity id under the testing.
This is used to get the entity id in order to get the state from the state This is used to get the entity id in order to get the state from the state
@ -136,11 +139,13 @@ def find_entity_id(domain, zha_device, hass: HomeAssistant, qualifier=None):
for entity_id in entities: for entity_id in entities:
if qualifier in entity_id: if qualifier in entity_id:
return entity_id return entity_id
else: return None
return entities[0] return entities[0]
def find_entity_ids(domain, zha_device, hass: HomeAssistant): def find_entity_ids(
domain: str, zha_device: ZHADeviceProxy, hass: HomeAssistant
) -> list[str]:
"""Find the entity ids under the testing. """Find the entity ids under the testing.
This is used to get the entity id in order to get the state from the state This is used to get the entity id in order to get the state from the state