Fix root-import pylint warning in components (#119294)

* Fix root-import pylint warning in components

* Adjust

* Adjust
This commit is contained in:
epenet 2024-06-10 15:14:49 +02:00 committed by GitHub
parent 94b9ae14c9
commit fbaba3753b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
47 changed files with 107 additions and 106 deletions

View file

@ -19,7 +19,11 @@ from zigpy.zcl.clusters import general, security
from zigpy.zcl.clusters.general import Groups
import zigpy.zdo.types as zdo_types
from homeassistant.components.websocket_api import const
from homeassistant.components.websocket_api import (
ERR_INVALID_FORMAT,
ERR_NOT_FOUND,
TYPE_RESULT,
)
from homeassistant.components.zha import DOMAIN
from homeassistant.components.zha.core.const import (
ATTR_CLUSTER_ID,
@ -336,9 +340,9 @@ async def test_device_not_found(zha_client) -> None:
)
msg = await zha_client.receive_json()
assert msg["id"] == 6
assert msg["type"] == const.TYPE_RESULT
assert msg["type"] == TYPE_RESULT
assert not msg["success"]
assert msg["error"]["code"] == const.ERR_NOT_FOUND
assert msg["error"]["code"] == ERR_NOT_FOUND
async def test_list_groups(zha_client) -> None:
@ -347,7 +351,7 @@ async def test_list_groups(zha_client) -> None:
msg = await zha_client.receive_json()
assert msg["id"] == 7
assert msg["type"] == const.TYPE_RESULT
assert msg["type"] == TYPE_RESULT
groups = msg["result"]
assert len(groups) == 1
@ -364,7 +368,7 @@ async def test_get_group(zha_client) -> None:
msg = await zha_client.receive_json()
assert msg["id"] == 8
assert msg["type"] == const.TYPE_RESULT
assert msg["type"] == TYPE_RESULT
group = msg["result"]
assert group is not None
@ -380,9 +384,9 @@ async def test_get_group_not_found(zha_client) -> None:
msg = await zha_client.receive_json()
assert msg["id"] == 9
assert msg["type"] == const.TYPE_RESULT
assert msg["type"] == TYPE_RESULT
assert not msg["success"]
assert msg["error"]["code"] == const.ERR_NOT_FOUND
assert msg["error"]["code"] == ERR_NOT_FOUND
async def test_list_groupable_devices(
@ -397,7 +401,7 @@ async def test_list_groupable_devices(
msg = await zha_client.receive_json()
assert msg["id"] == 10
assert msg["type"] == const.TYPE_RESULT
assert msg["type"] == TYPE_RESULT
device_endpoints = msg["result"]
assert len(device_endpoints) == 1
@ -427,7 +431,7 @@ async def test_list_groupable_devices(
msg = await zha_client.receive_json()
assert msg["id"] == 11
assert msg["type"] == const.TYPE_RESULT
assert msg["type"] == TYPE_RESULT
device_endpoints = msg["result"]
assert len(device_endpoints) == 0
@ -439,7 +443,7 @@ async def test_add_group(zha_client) -> None:
msg = await zha_client.receive_json()
assert msg["id"] == 12
assert msg["type"] == const.TYPE_RESULT
assert msg["type"] == TYPE_RESULT
added_group = msg["result"]
@ -450,7 +454,7 @@ async def test_add_group(zha_client) -> None:
msg = await zha_client.receive_json()
assert msg["id"] == 13
assert msg["type"] == const.TYPE_RESULT
assert msg["type"] == TYPE_RESULT
groups = msg["result"]
assert len(groups) == 2
@ -466,7 +470,7 @@ async def test_remove_group(zha_client) -> None:
msg = await zha_client.receive_json()
assert msg["id"] == 14
assert msg["type"] == const.TYPE_RESULT
assert msg["type"] == TYPE_RESULT
groups = msg["result"]
assert len(groups) == 1
@ -477,7 +481,7 @@ async def test_remove_group(zha_client) -> None:
msg = await zha_client.receive_json()
assert msg["id"] == 15
assert msg["type"] == const.TYPE_RESULT
assert msg["type"] == TYPE_RESULT
groups_remaining = msg["result"]
assert len(groups_remaining) == 0
@ -486,7 +490,7 @@ async def test_remove_group(zha_client) -> None:
msg = await zha_client.receive_json()
assert msg["id"] == 16
assert msg["type"] == const.TYPE_RESULT
assert msg["type"] == TYPE_RESULT
groups = msg["result"]
assert len(groups) == 0
@ -710,14 +714,14 @@ async def test_ws_permit_with_qr_code(
)
msg_type = None
while msg_type != const.TYPE_RESULT:
while msg_type != TYPE_RESULT:
# There will be logging events coming over the websocket
# as well so we want to ignore those
msg = await zha_client.receive_json()
msg_type = msg["type"]
assert msg["id"] == 14
assert msg["type"] == const.TYPE_RESULT
assert msg["type"] == TYPE_RESULT
assert msg["success"]
assert app_controller.permit.await_count == 0
@ -739,7 +743,7 @@ async def test_ws_permit_with_install_code_fail(
msg = await zha_client.receive_json()
assert msg["id"] == 14
assert msg["type"] == const.TYPE_RESULT
assert msg["type"] == TYPE_RESULT
assert msg["success"] is False
assert app_controller.permit.await_count == 0
@ -773,14 +777,14 @@ async def test_ws_permit_ha12(
)
msg_type = None
while msg_type != const.TYPE_RESULT:
while msg_type != TYPE_RESULT:
# There will be logging events coming over the websocket
# as well so we want to ignore those
msg = await zha_client.receive_json()
msg_type = msg["type"]
assert msg["id"] == 14
assert msg["type"] == const.TYPE_RESULT
assert msg["type"] == TYPE_RESULT
assert msg["success"]
assert app_controller.permit.await_count == 1
@ -800,7 +804,7 @@ async def test_get_network_settings(
msg = await zha_client.receive_json()
assert msg["id"] == 6
assert msg["type"] == const.TYPE_RESULT
assert msg["type"] == TYPE_RESULT
assert msg["success"]
assert "radio_type" in msg["result"]
assert "network_info" in msg["result"]["settings"]
@ -818,7 +822,7 @@ async def test_list_network_backups(
msg = await zha_client.receive_json()
assert msg["id"] == 6
assert msg["type"] == const.TYPE_RESULT
assert msg["type"] == TYPE_RESULT
assert msg["success"]
assert "network_info" in msg["result"][0]
@ -834,7 +838,7 @@ async def test_create_network_backup(
assert len(app_controller.backups.backups) == 1
assert msg["id"] == 6
assert msg["type"] == const.TYPE_RESULT
assert msg["type"] == TYPE_RESULT
assert msg["success"]
assert "backup" in msg["result"] and "is_complete" in msg["result"]
@ -860,7 +864,7 @@ async def test_restore_network_backup_success(
assert "ezsp" not in backup.network_info.stack_specific
assert msg["id"] == 6
assert msg["type"] == const.TYPE_RESULT
assert msg["type"] == TYPE_RESULT
assert msg["success"]
@ -892,7 +896,7 @@ async def test_restore_network_backup_force_write_eui64(
)
assert msg["id"] == 6
assert msg["type"] == const.TYPE_RESULT
assert msg["type"] == TYPE_RESULT
assert msg["success"]
@ -915,9 +919,9 @@ async def test_restore_network_backup_failure(
p.assert_called_once_with("a backup")
assert msg["id"] == 6
assert msg["type"] == const.TYPE_RESULT
assert msg["type"] == TYPE_RESULT
assert not msg["success"]
assert msg["error"]["code"] == const.ERR_INVALID_FORMAT
assert msg["error"]["code"] == ERR_INVALID_FORMAT
@pytest.mark.parametrize("new_channel", ["auto", 15])
@ -940,7 +944,7 @@ async def test_websocket_change_channel(
msg = await zha_client.receive_json()
assert msg["id"] == 6
assert msg["type"] == const.TYPE_RESULT
assert msg["type"] == TYPE_RESULT
assert msg["success"]
change_channel_mock.assert_has_calls([call(ANY, new_channel)])
@ -973,7 +977,7 @@ async def test_websocket_bind_unbind_devices(
msg = await zha_client.receive_json()
assert msg["id"] == 27
assert msg["type"] == const.TYPE_RESULT
assert msg["type"] == TYPE_RESULT
assert msg["success"]
assert binding_operation_mock.mock_calls == [
call(
@ -1027,7 +1031,7 @@ async def test_websocket_bind_unbind_group(
msg = await zha_client.receive_json()
assert msg["id"] == 27
assert msg["type"] == const.TYPE_RESULT
assert msg["type"] == TYPE_RESULT
assert msg["success"]
if command_type == "bind":
assert bind_mock.mock_calls == [call(test_group_id, ANY)]