mirror of
https://github.com/home-assistant/core.git
synced 2025-07-17 18:27:09 +00:00
Apply bond python related feedback from a prior PR (#37821)
This commit is contained in:
parent
4aaf7c5432
commit
ed3f25489e
@ -26,34 +26,28 @@ class BondDevice:
|
|||||||
def supports_speed(self) -> bool:
|
def supports_speed(self) -> bool:
|
||||||
"""Return True if this device supports any of the speed related commands."""
|
"""Return True if this device supports any of the speed related commands."""
|
||||||
actions: List[str] = self._attrs["actions"]
|
actions: List[str] = self._attrs["actions"]
|
||||||
return len([action for action in actions if action in [Actions.SET_SPEED]]) > 0
|
return bool([action for action in actions if action in [Actions.SET_SPEED]])
|
||||||
|
|
||||||
def supports_direction(self) -> bool:
|
def supports_direction(self) -> bool:
|
||||||
"""Return True if this device supports any of the direction related commands."""
|
"""Return True if this device supports any of the direction related commands."""
|
||||||
actions: List[str] = self._attrs["actions"]
|
actions: List[str] = self._attrs["actions"]
|
||||||
return (
|
return bool(
|
||||||
len(
|
[
|
||||||
[
|
action
|
||||||
action
|
for action in actions
|
||||||
for action in actions
|
if action in [Actions.SET_DIRECTION, Actions.TOGGLE_DIRECTION]
|
||||||
if action in [Actions.SET_DIRECTION, Actions.TOGGLE_DIRECTION]
|
]
|
||||||
]
|
|
||||||
)
|
|
||||||
> 0
|
|
||||||
)
|
)
|
||||||
|
|
||||||
def supports_light(self) -> bool:
|
def supports_light(self) -> bool:
|
||||||
"""Return True if this device supports any of the light related commands."""
|
"""Return True if this device supports any of the light related commands."""
|
||||||
actions: List[str] = self._attrs["actions"]
|
actions: List[str] = self._attrs["actions"]
|
||||||
return (
|
return bool(
|
||||||
len(
|
[
|
||||||
[
|
action
|
||||||
action
|
for action in actions
|
||||||
for action in actions
|
if action in [Actions.TURN_LIGHT_ON, Actions.TOGGLE_LIGHT]
|
||||||
if action in [Actions.TURN_LIGHT_ON, Actions.TOGGLE_LIGHT]
|
]
|
||||||
]
|
|
||||||
)
|
|
||||||
> 0
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ async def test_entity_registry(hass: core.HomeAssistant):
|
|||||||
await setup_platform(hass, COVER_DOMAIN, shades("name-1"))
|
await setup_platform(hass, COVER_DOMAIN, shades("name-1"))
|
||||||
|
|
||||||
registry: EntityRegistry = await hass.helpers.entity_registry.async_get_registry()
|
registry: EntityRegistry = await hass.helpers.entity_registry.async_get_registry()
|
||||||
assert [key for key in registry.entities.keys()] == ["cover.name_1"]
|
assert [key for key in registry.entities] == ["cover.name_1"]
|
||||||
|
|
||||||
|
|
||||||
async def test_open_cover(hass: core.HomeAssistant):
|
async def test_open_cover(hass: core.HomeAssistant):
|
||||||
|
@ -36,7 +36,7 @@ async def test_entity_registry(hass: core.HomeAssistant):
|
|||||||
await setup_platform(hass, FAN_DOMAIN, ceiling_fan("name-1"))
|
await setup_platform(hass, FAN_DOMAIN, ceiling_fan("name-1"))
|
||||||
|
|
||||||
registry: EntityRegistry = await hass.helpers.entity_registry.async_get_registry()
|
registry: EntityRegistry = await hass.helpers.entity_registry.async_get_registry()
|
||||||
assert [key for key in registry.entities.keys()] == ["fan.name_1"]
|
assert [key for key in registry.entities] == ["fan.name_1"]
|
||||||
|
|
||||||
|
|
||||||
async def test_turn_on_fan(hass: core.HomeAssistant):
|
async def test_turn_on_fan(hass: core.HomeAssistant):
|
||||||
|
@ -32,7 +32,7 @@ async def test_entity_registry(hass: core.HomeAssistant):
|
|||||||
await setup_platform(hass, LIGHT_DOMAIN, ceiling_fan("name-1"))
|
await setup_platform(hass, LIGHT_DOMAIN, ceiling_fan("name-1"))
|
||||||
|
|
||||||
registry: EntityRegistry = await hass.helpers.entity_registry.async_get_registry()
|
registry: EntityRegistry = await hass.helpers.entity_registry.async_get_registry()
|
||||||
assert [key for key in registry.entities.keys()] == ["light.name_1"]
|
assert [key for key in registry.entities] == ["light.name_1"]
|
||||||
|
|
||||||
|
|
||||||
async def test_turn_on_light(hass: core.HomeAssistant):
|
async def test_turn_on_light(hass: core.HomeAssistant):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user