Apply bond python related feedback from a prior PR (#37821)
This commit is contained in:
parent
4aaf7c5432
commit
ed3f25489e
4 changed files with 16 additions and 22 deletions
|
@ -26,34 +26,28 @@ class BondDevice:
|
|||
def supports_speed(self) -> bool:
|
||||
"""Return True if this device supports any of the speed related commands."""
|
||||
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:
|
||||
"""Return True if this device supports any of the direction related commands."""
|
||||
actions: List[str] = self._attrs["actions"]
|
||||
return (
|
||||
len(
|
||||
[
|
||||
action
|
||||
for action in actions
|
||||
if action in [Actions.SET_DIRECTION, Actions.TOGGLE_DIRECTION]
|
||||
]
|
||||
)
|
||||
> 0
|
||||
return bool(
|
||||
[
|
||||
action
|
||||
for action in actions
|
||||
if action in [Actions.SET_DIRECTION, Actions.TOGGLE_DIRECTION]
|
||||
]
|
||||
)
|
||||
|
||||
def supports_light(self) -> bool:
|
||||
"""Return True if this device supports any of the light related commands."""
|
||||
actions: List[str] = self._attrs["actions"]
|
||||
return (
|
||||
len(
|
||||
[
|
||||
action
|
||||
for action in actions
|
||||
if action in [Actions.TURN_LIGHT_ON, Actions.TOGGLE_LIGHT]
|
||||
]
|
||||
)
|
||||
> 0
|
||||
return bool(
|
||||
[
|
||||
action
|
||||
for action in actions
|
||||
if action in [Actions.TURN_LIGHT_ON, Actions.TOGGLE_LIGHT]
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ async def test_entity_registry(hass: core.HomeAssistant):
|
|||
await setup_platform(hass, COVER_DOMAIN, shades("name-1"))
|
||||
|
||||
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):
|
||||
|
|
|
@ -36,7 +36,7 @@ async def test_entity_registry(hass: core.HomeAssistant):
|
|||
await setup_platform(hass, FAN_DOMAIN, ceiling_fan("name-1"))
|
||||
|
||||
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):
|
||||
|
|
|
@ -32,7 +32,7 @@ async def test_entity_registry(hass: core.HomeAssistant):
|
|||
await setup_platform(hass, LIGHT_DOMAIN, ceiling_fan("name-1"))
|
||||
|
||||
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):
|
||||
|
|
Loading…
Add table
Reference in a new issue