mirror of
https://github.com/home-assistant/core.git
synced 2025-04-24 17:27:52 +00:00
Enable Ruff PT006 (#88165)
* Enable Ruff PT006 * Adjust existing cases * Fix tests * Remove unneeded parentheses
This commit is contained in:
parent
6f38bc274a
commit
ed79265843
@ -34,7 +34,7 @@ from .conftest import (
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"integration_type,input_form_step,patched_method,config,entry_title",
|
||||
("integration_type", "input_form_step", "patched_method", "config", "entry_title"),
|
||||
[
|
||||
(
|
||||
INTEGRATION_TYPE_GEOGRAPHY_COORDS,
|
||||
|
@ -16,7 +16,7 @@ from homeassistant.core import HomeAssistant
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"connect_mock,connect_errors",
|
||||
("connect_mock", "connect_errors"),
|
||||
[
|
||||
(AsyncMock(side_effect=Exception), {"base": "unknown"}),
|
||||
(AsyncMock(side_effect=InvalidAuthenticationError), {"base": "invalid_auth"}),
|
||||
@ -84,7 +84,7 @@ async def test_step_import(hass: HomeAssistant, config, setup_airvisual_pro) ->
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"connect_mock,connect_errors",
|
||||
("connect_mock", "connect_errors"),
|
||||
[
|
||||
(AsyncMock(side_effect=Exception), {"base": "unknown"}),
|
||||
(AsyncMock(side_effect=InvalidAuthenticationError), {"base": "invalid_auth"}),
|
||||
|
@ -32,7 +32,7 @@ from tests.components.blueprint.conftest import stub_blueprint_populate # noqa:
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"set_state,features_reg,features_state,expected_action_types",
|
||||
("set_state", "features_reg", "features_state", "expected_action_types"),
|
||||
[
|
||||
(False, 0, 0, ["disarm"]),
|
||||
(
|
||||
@ -127,7 +127,7 @@ async def test_get_actions(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"hidden_by,entity_category",
|
||||
("hidden_by", "entity_category"),
|
||||
(
|
||||
(er.RegistryEntryHider.INTEGRATION, None),
|
||||
(er.RegistryEntryHider.USER, None),
|
||||
|
@ -37,7 +37,7 @@ def calls(hass: HomeAssistant) -> list[ServiceCall]:
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"set_state,features_reg,features_state,expected_condition_types",
|
||||
("set_state", "features_reg", "features_state", "expected_condition_types"),
|
||||
[
|
||||
(False, 0, 0, []),
|
||||
(False, AlarmControlPanelEntityFeature.ARM_AWAY, 0, ["is_armed_away"]),
|
||||
@ -133,7 +133,7 @@ async def test_get_conditions(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"hidden_by,entity_category",
|
||||
("hidden_by", "entity_category"),
|
||||
(
|
||||
(er.RegistryEntryHider.INTEGRATION, None),
|
||||
(er.RegistryEntryHider.USER, None),
|
||||
|
@ -42,7 +42,7 @@ def calls(hass: HomeAssistant) -> list[ServiceCall]:
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"set_state,features_reg,features_state,expected_trigger_types",
|
||||
("set_state", "features_reg", "features_state", "expected_trigger_types"),
|
||||
[
|
||||
(False, 0, 0, ["triggered", "disarmed", "arming"]),
|
||||
(
|
||||
@ -125,7 +125,7 @@ async def test_get_triggers(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"hidden_by,entity_category",
|
||||
("hidden_by", "entity_category"),
|
||||
(
|
||||
(er.RegistryEntryHider.INTEGRATION, None),
|
||||
(er.RegistryEntryHider.USER, None),
|
||||
|
@ -35,7 +35,7 @@ from tests.common import MockConfigEntry
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"protocol,connection,title",
|
||||
("protocol", "connection", "title"),
|
||||
[
|
||||
(
|
||||
PROTOCOL_SOCKET,
|
||||
@ -394,7 +394,7 @@ async def test_options_zone_flow_validation(hass: HomeAssistant) -> None:
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"protocol,connection",
|
||||
("protocol", "connection"),
|
||||
[
|
||||
(
|
||||
PROTOCOL_SOCKET,
|
||||
|
@ -119,7 +119,7 @@ async def test_api_set_color_temperature(hass: HomeAssistant) -> None:
|
||||
assert msg["header"]["name"] == "Response"
|
||||
|
||||
|
||||
@pytest.mark.parametrize("result,initial", [(383, "333"), (500, "500")])
|
||||
@pytest.mark.parametrize(("result", "initial"), [(383, "333"), (500, "500")])
|
||||
async def test_api_decrease_color_temp(
|
||||
hass: HomeAssistant, result: int, initial: str
|
||||
) -> None:
|
||||
@ -149,7 +149,7 @@ async def test_api_decrease_color_temp(
|
||||
assert msg["header"]["name"] == "Response"
|
||||
|
||||
|
||||
@pytest.mark.parametrize("result,initial", [(283, "333"), (142, "142")])
|
||||
@pytest.mark.parametrize(("result", "initial"), [(283, "333"), (142, "142")])
|
||||
async def test_api_increase_color_temp(
|
||||
hass: HomeAssistant, result: int, initial: str
|
||||
) -> None:
|
||||
@ -180,7 +180,7 @@ async def test_api_increase_color_temp(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"domain,payload,source_list,idx",
|
||||
("domain", "payload", "source_list", "idx"),
|
||||
[
|
||||
("media_player", "GAME CONSOLE", ["tv", "game console", 10000], 1),
|
||||
("media_player", "SATELLITE TV", ["satellite-tv", "game console"], 0),
|
||||
|
@ -4120,7 +4120,7 @@ async def test_camera_discovery_without_stream(hass: HomeAssistant) -> None:
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"url,result",
|
||||
("url", "result"),
|
||||
[
|
||||
("http://nohttpswrongport.org:8123", 2),
|
||||
("http://nohttpsport443.org:443", 2),
|
||||
|
@ -357,7 +357,7 @@ async def test_report_state_humidifier(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"domain,value,unit,label",
|
||||
("domain", "value", "unit", "label"),
|
||||
[
|
||||
(
|
||||
"number",
|
||||
|
@ -12,7 +12,7 @@ from homeassistant.core import HomeAssistant
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"devices_response,errors",
|
||||
("devices_response", "errors"),
|
||||
[
|
||||
(AsyncMock(side_effect=AmbientError), {"base": "invalid_key"}),
|
||||
(AsyncMock(return_value=[]), {"base": "no_devices"}),
|
||||
|
@ -83,7 +83,7 @@ class MockConfigDevice:
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
["config", "eth_mac", "wifi_mac"],
|
||||
("config", "eth_mac", "wifi_mac"),
|
||||
[
|
||||
(CONFIG_PYTHON_ADB, ETH_MAC, None),
|
||||
(CONFIG_ADB_SERVER, ETH_MAC, None),
|
||||
@ -202,7 +202,7 @@ async def test_error_invalid_key(hass: HomeAssistant) -> None:
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
["config", "eth_mac", "wifi_mac"],
|
||||
("config", "eth_mac", "wifi_mac"),
|
||||
[
|
||||
(CONFIG_ADB_SERVER, None, None),
|
||||
(CONFIG_PYTHON_ADB, None, None),
|
||||
|
@ -395,7 +395,7 @@ async def test_sources(hass: HomeAssistant, config: dict[str, Any]) -> None:
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
["config", "expected_sources"],
|
||||
("config", "expected_sources"),
|
||||
[
|
||||
(CONFIG_ANDROIDTV_DEFAULT, ["TEST 1"]),
|
||||
(CONFIG_FIRETV_DEFAULT, ["TEST 1"]),
|
||||
@ -482,7 +482,7 @@ async def _test_select_source(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
["source", "expected_arg", "method_patch"],
|
||||
("source", "expected_arg", "method_patch"),
|
||||
[
|
||||
("com.app.test1", "com.app.test1", patchers.PATCH_LAUNCH_APP),
|
||||
("TEST 1", "com.app.test1", patchers.PATCH_LAUNCH_APP),
|
||||
@ -526,7 +526,7 @@ async def test_androidtv_select_source_overridden_app_name(hass: HomeAssistant)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
["source", "expected_arg", "method_patch"],
|
||||
("source", "expected_arg", "method_patch"),
|
||||
[
|
||||
("com.app.test1", "com.app.test1", patchers.PATCH_LAUNCH_APP),
|
||||
("TEST 1", "com.app.test1", patchers.PATCH_LAUNCH_APP),
|
||||
@ -552,7 +552,7 @@ async def test_select_source_firetv(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
["config", "connect"],
|
||||
("config", "connect"),
|
||||
[
|
||||
(CONFIG_ANDROIDTV_DEFAULT, False),
|
||||
(CONFIG_FIRETV_DEFAULT, False),
|
||||
|
@ -19,7 +19,7 @@ from tests.common import MockConfigEntry
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"entity_id,entity_name",
|
||||
("entity_id", "entity_name"),
|
||||
[
|
||||
("media_player.anthem_av", "Anthem AV"),
|
||||
("media_player.anthem_av_zone_2", "Anthem AV zone 2"),
|
||||
|
@ -131,7 +131,7 @@ async def test_flow_works(hass: HomeAssistant) -> None:
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"extra_status,expected_title",
|
||||
("extra_status", "expected_title"),
|
||||
[
|
||||
({"UPSNAME": "Friendly Name"}, "Friendly Name"),
|
||||
({"MODEL": "MODEL X"}, "MODEL X"),
|
||||
|
@ -113,7 +113,7 @@ async def test_update(player, state) -> None:
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"source, value",
|
||||
("source", "value"),
|
||||
[("PVR", SourceCodes.PVR), ("BD", SourceCodes.BD), ("INVALID", None)],
|
||||
)
|
||||
async def test_select_source(
|
||||
@ -168,7 +168,7 @@ async def test_volume_down(player, state) -> None:
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"mode, mode_enum",
|
||||
("mode", "mode_enum"),
|
||||
[
|
||||
("STEREO", DecodeMode2CH.STEREO),
|
||||
("STEREO_DOWNMIX", DecodeModeMCH.STEREO_DOWNMIX),
|
||||
@ -183,7 +183,7 @@ async def test_sound_mode(player, state, mode, mode_enum) -> None:
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"modes, modes_enum",
|
||||
("modes", "modes_enum"),
|
||||
[
|
||||
(["STEREO", "DOLBY_PL"], [DecodeMode2CH.STEREO, DecodeMode2CH.DOLBY_PL]),
|
||||
(["STEREO_DOWNMIX"], [DecodeModeMCH.STEREO_DOWNMIX]),
|
||||
@ -219,7 +219,7 @@ async def test_volume_level(player, state) -> None:
|
||||
assert player.volume_level is None
|
||||
|
||||
|
||||
@pytest.mark.parametrize("volume, call", [(0.0, 0), (0.5, 50), (1.0, 99)])
|
||||
@pytest.mark.parametrize(("volume", "call"), [(0.0, 0), (0.5, 50), (1.0, 99)])
|
||||
async def test_set_volume_level(player, state, volume, call) -> None:
|
||||
"""Test setting volume."""
|
||||
await player.async_set_volume_level(volume)
|
||||
@ -227,7 +227,7 @@ async def test_set_volume_level(player, state, volume, call) -> None:
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"source, media_content_type",
|
||||
("source", "media_content_type"),
|
||||
[
|
||||
(SourceCodes.DAB, MediaType.MUSIC),
|
||||
(SourceCodes.FM, MediaType.MUSIC),
|
||||
@ -242,7 +242,7 @@ async def test_media_content_type(player, state, source, media_content_type) ->
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"source, dab, rds, channel",
|
||||
("source", "dab", "rds", "channel"),
|
||||
[
|
||||
(SourceCodes.DAB, "dab", "rds", "dab"),
|
||||
(SourceCodes.DAB, None, None, None),
|
||||
@ -260,7 +260,7 @@ async def test_media_channel(player, state, source, dab, rds, channel) -> None:
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"source, dls, artist",
|
||||
("source", "dls", "artist"),
|
||||
[
|
||||
(SourceCodes.DAB, "dls", "dls"),
|
||||
(SourceCodes.FM, "dls", None),
|
||||
@ -275,7 +275,7 @@ async def test_media_artist(player, state, source, dls, artist) -> None:
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"source, channel, title",
|
||||
("source", "channel", "title"),
|
||||
[
|
||||
(SourceCodes.DAB, "channel", "DAB - channel"),
|
||||
(SourceCodes.DAB, None, "DAB"),
|
||||
|
@ -48,7 +48,7 @@ async def test_form(hass: HomeAssistant) -> None:
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"error_web, error_mobile, reason",
|
||||
("error_web", "error_mobile", "reason"),
|
||||
[
|
||||
(APIUnavailable, None, "cannot_connect"),
|
||||
(InvalidAuthCredentials, None, "invalid_auth"),
|
||||
|
@ -102,7 +102,7 @@ async def test_user(hass: HomeAssistant, mock_unique_id, unique_id) -> None:
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
["config", "error"],
|
||||
("config", "error"),
|
||||
[
|
||||
({CONF_PASSWORD: None}, "pwd_or_ssh"),
|
||||
({CONF_SSH_KEY: SSH_KEY}, "pwd_and_ssh"),
|
||||
@ -221,7 +221,7 @@ async def test_abort_invalid_unique_id(hass: HomeAssistant) -> None:
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
["side_effect", "error"],
|
||||
("side_effect", "error"),
|
||||
[
|
||||
(OSError, "cannot_connect"),
|
||||
(TypeError, "unknown"),
|
||||
|
@ -386,7 +386,7 @@ async def test_refresh_token_provider_rejected(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"url,base_data", [("/auth/token", {"action": "revoke"}), ("/auth/revoke", {})]
|
||||
("url", "base_data"), [("/auth/token", {"action": "revoke"}), ("/auth/revoke", {})]
|
||||
)
|
||||
async def test_revoking_refresh_token(
|
||||
url, base_data, hass: HomeAssistant, aiohttp_client: ClientSessionGenerator
|
||||
|
@ -1354,7 +1354,7 @@ async def test_automation_not_trigger_on_bootstrap(hass: HomeAssistant) -> None:
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"broken_config, problem, details",
|
||||
("broken_config", "problem", "details"),
|
||||
(
|
||||
(
|
||||
{},
|
||||
@ -1984,7 +1984,7 @@ async def test_blueprint_automation(hass: HomeAssistant, calls) -> None:
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"blueprint_inputs, problem, details",
|
||||
("blueprint_inputs", "problem", "details"),
|
||||
(
|
||||
(
|
||||
# No input
|
||||
@ -2193,7 +2193,7 @@ async def test_trigger_condition_explicit_id(hass: HomeAssistant, calls) -> None
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"automation_mode,automation_runs",
|
||||
("automation_mode", "automation_runs"),
|
||||
(
|
||||
(SCRIPT_MODE_PARALLEL, 2),
|
||||
(SCRIPT_MODE_QUEUED, 2),
|
||||
|
@ -246,7 +246,7 @@ async def test_reauth_flow_update_configuration(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"source,discovery_info",
|
||||
("source", "discovery_info"),
|
||||
[
|
||||
(
|
||||
SOURCE_DHCP,
|
||||
@ -349,7 +349,7 @@ async def test_discovery_flow(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"source,discovery_info",
|
||||
("source", "discovery_info"),
|
||||
[
|
||||
(
|
||||
SOURCE_DHCP,
|
||||
@ -401,7 +401,7 @@ async def test_discovered_device_already_configured(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"source,discovery_info,expected_port",
|
||||
("source", "discovery_info", "expected_port"),
|
||||
[
|
||||
(
|
||||
SOURCE_DHCP,
|
||||
@ -477,7 +477,7 @@ async def test_discovery_flow_updated_configuration(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"source,discovery_info",
|
||||
("source", "discovery_info"),
|
||||
[
|
||||
(
|
||||
SOURCE_DHCP,
|
||||
@ -526,7 +526,7 @@ async def test_discovery_flow_ignore_non_axis_device(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"source,discovery_info",
|
||||
("source", "discovery_info"),
|
||||
[
|
||||
(
|
||||
SOURCE_DHCP,
|
||||
|
@ -31,7 +31,7 @@ _LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"step1_config, step_id, step2_config, data_config",
|
||||
("step1_config", "step_id", "step2_config", "data_config"),
|
||||
[
|
||||
(BASE_CONFIG_CS, STEP_CONN_STRING, CS_CONFIG, CS_CONFIG_FULL),
|
||||
(BASE_CONFIG_SAS, STEP_SAS, SAS_CONFIG, SAS_CONFIG_FULL),
|
||||
@ -115,7 +115,7 @@ async def test_single_instance(hass: HomeAssistant, source) -> None:
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"side_effect, error_message",
|
||||
("side_effect", "error_message"),
|
||||
[(EventHubError("test"), "cannot_connect"), (Exception, "unknown")],
|
||||
ids=["cannot_connect", "unknown"],
|
||||
)
|
||||
@ -144,7 +144,7 @@ async def test_connection_error_sas(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"side_effect, error_message",
|
||||
("side_effect", "error_message"),
|
||||
[(EventHubError("test"), "cannot_connect"), (Exception, "unknown")],
|
||||
ids=["cannot_connect", "unknown"],
|
||||
)
|
||||
|
@ -140,7 +140,7 @@ async def test_full_batch(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"filter_schema, tests",
|
||||
("filter_schema", "tests"),
|
||||
[
|
||||
(
|
||||
{
|
||||
|
@ -75,7 +75,7 @@ async def test_get_conditions(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"hidden_by,entity_category",
|
||||
("hidden_by", "entity_category"),
|
||||
(
|
||||
(er.RegistryEntryHider.INTEGRATION, None),
|
||||
(er.RegistryEntryHider.USER, None),
|
||||
|
@ -75,7 +75,7 @@ async def test_get_triggers(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"hidden_by,entity_category",
|
||||
("hidden_by", "entity_category"),
|
||||
(
|
||||
(er.RegistryEntryHider.INTEGRATION, None),
|
||||
(er.RegistryEntryHider.USER, None),
|
||||
|
@ -18,7 +18,7 @@ VEHICLE_NAME_SLUG = "i3_rex"
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"entitydata,old_unique_id,new_unique_id",
|
||||
("entitydata", "old_unique_id", "new_unique_id"),
|
||||
[
|
||||
(
|
||||
{
|
||||
@ -75,7 +75,7 @@ async def test_migrate_unique_ids(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"entitydata,old_unique_id,new_unique_id",
|
||||
("entitydata", "old_unique_id", "new_unique_id"),
|
||||
[
|
||||
(
|
||||
{
|
||||
|
@ -12,7 +12,7 @@ from . import setup_mocked_integration
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"entity_id,unit_system,value,unit_of_measurement",
|
||||
("entity_id", "unit_system", "value", "unit_of_measurement"),
|
||||
[
|
||||
("sensor.i3_rex_remaining_range_total", METRIC, "279", "km"),
|
||||
("sensor.i3_rex_remaining_range_total", IMPERIAL, "173.36", "mi"),
|
||||
|
@ -192,7 +192,7 @@ async def test_user_invalid_host(hass: HomeAssistant) -> None:
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"side_effect, error_message",
|
||||
("side_effect", "error_message"),
|
||||
[
|
||||
(BraviaAuthError, "invalid_auth"),
|
||||
(BraviaNotSupported, "unsupported_model"),
|
||||
@ -219,7 +219,7 @@ async def test_pin_form_error(hass: HomeAssistant, side_effect, error_message) -
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"side_effect, error_message",
|
||||
("side_effect", "error_message"),
|
||||
[
|
||||
(BraviaAuthError, "invalid_auth"),
|
||||
(BraviaNotSupported, "unsupported_model"),
|
||||
@ -376,7 +376,7 @@ async def test_create_entry_psk(hass: HomeAssistant) -> None:
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"use_psk, new_pin",
|
||||
("use_psk", "new_pin"),
|
||||
[
|
||||
(True, "7777"),
|
||||
(False, "newpsk"),
|
||||
|
@ -63,7 +63,7 @@ async def test_form_duplicate_login(hass: HomeAssistant) -> None:
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"side_effect, error_message",
|
||||
("side_effect", "error_message"),
|
||||
[
|
||||
(ServerDisconnectedError, "cannot_connect"),
|
||||
(ClientResponseError(Mock(), None, status=403), "invalid_auth"),
|
||||
@ -86,7 +86,7 @@ async def test_form_error(hass: HomeAssistant, side_effect, error_message) -> No
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"side_effect, result_type, password, step_id, reason",
|
||||
("side_effect", "result_type", "password", "step_id", "reason"),
|
||||
[
|
||||
(None, data_entry_flow.FlowResultType.ABORT, "test", None, "reauth_successful"),
|
||||
(
|
||||
|
@ -16,7 +16,7 @@ _LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"mac_address, advertisement, bind_key, result",
|
||||
("mac_address", "advertisement", "bind_key", "result"),
|
||||
[
|
||||
(
|
||||
"A4:C1:38:8D:18:B2",
|
||||
@ -102,7 +102,7 @@ async def test_v1_binary_sensors(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"mac_address, advertisement, bind_key, result",
|
||||
("mac_address", "advertisement", "bind_key", "result"),
|
||||
[
|
||||
(
|
||||
"A4:C1:38:8D:18:B2",
|
||||
|
@ -18,7 +18,7 @@ _LOGGER = logging.getLogger(__name__)
|
||||
|
||||
# Tests for BTHome v1
|
||||
@pytest.mark.parametrize(
|
||||
"mac_address, advertisement, bind_key, result",
|
||||
("mac_address", "advertisement", "bind_key", "result"),
|
||||
[
|
||||
(
|
||||
"A4:C1:38:8D:18:B2",
|
||||
@ -372,7 +372,7 @@ async def test_v1_sensors(
|
||||
|
||||
# Tests for BTHome V2
|
||||
@pytest.mark.parametrize(
|
||||
"mac_address, advertisement, bind_key, result",
|
||||
("mac_address", "advertisement", "bind_key", "result"),
|
||||
[
|
||||
(
|
||||
"A4:C1:38:8D:18:B2",
|
||||
|
@ -48,7 +48,7 @@ async def test_get_actions(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"hidden_by,entity_category",
|
||||
("hidden_by", "entity_category"),
|
||||
(
|
||||
(er.RegistryEntryHider.INTEGRATION, None),
|
||||
(er.RegistryEntryHider.USER, None),
|
||||
|
@ -57,7 +57,7 @@ async def test_get_triggers(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"hidden_by,entity_category",
|
||||
("hidden_by", "entity_category"),
|
||||
(
|
||||
(er.RegistryEntryHider.INTEGRATION, None),
|
||||
(er.RegistryEntryHider.USER, None),
|
||||
|
@ -88,7 +88,7 @@ async def test_calendars_http_api(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"payload,code",
|
||||
("payload", "code"),
|
||||
[
|
||||
(
|
||||
{
|
||||
@ -198,7 +198,7 @@ async def test_unsupported_create_event_service(hass: HomeAssistant) -> None:
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"date_fields,expected_error,error_match",
|
||||
("date_fields", "expected_error", "error_match"),
|
||||
[
|
||||
(
|
||||
{},
|
||||
|
@ -215,7 +215,7 @@ async def test_event_start_trigger(hass: HomeAssistant, calls, fake_schedule) ->
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"offset_str, offset_delta",
|
||||
("offset_str", "offset_delta"),
|
||||
[
|
||||
("-01:00", datetime.timedelta(hours=-1)),
|
||||
("+01:00", datetime.timedelta(hours=1)),
|
||||
@ -278,7 +278,7 @@ async def test_event_end_trigger(hass: HomeAssistant, calls, fake_schedule) -> N
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"offset_str, offset_delta",
|
||||
("offset_str", "offset_delta"),
|
||||
[
|
||||
("-01:00", datetime.timedelta(hours=-1)),
|
||||
("+01:00", datetime.timedelta(hours=1)),
|
||||
@ -566,7 +566,7 @@ async def test_update_missed(hass: HomeAssistant, calls, fake_schedule) -> None:
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"create_data,fire_time,payload_data",
|
||||
("create_data", "fire_time", "payload_data"),
|
||||
[
|
||||
(
|
||||
{
|
||||
|
@ -102,7 +102,7 @@ SCALE_TEST_EXPECTED = [
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"image_width, image_height, input_width, input_height, scaling_factor",
|
||||
("image_width", "image_height", "input_width", "input_height", "scaling_factor"),
|
||||
SCALE_TEST_EXPECTED,
|
||||
)
|
||||
def test_find_supported_scaling_factor(
|
||||
|
@ -17,7 +17,7 @@ from tests.test_util.aiohttp import AiohttpClientMocker
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"url,fixture,content_type",
|
||||
("url", "fixture", "content_type"),
|
||||
(
|
||||
(
|
||||
"http://a.files.bbci.co.uk/media/live/manifesto/audio/simulcast/hls/nonuk/sbr_low/ak/bbc_radio_fourfm.m3u8",
|
||||
@ -47,7 +47,7 @@ async def test_hls_playlist_supported(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"url,fixture,content_type,expected_playlist",
|
||||
("url", "fixture", "content_type", "expected_playlist"),
|
||||
(
|
||||
(
|
||||
"https://sverigesradio.se/topsy/direkt/209-hi-mp3.m3u",
|
||||
@ -115,7 +115,7 @@ async def test_parse_playlist(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"url,fixture",
|
||||
("url", "fixture"),
|
||||
(
|
||||
("http://sverigesradio.se/164-hi-aac.pls", "164-hi-aac_invalid_entries.pls"),
|
||||
("http://sverigesradio.se/164-hi-aac.pls", "164-hi-aac_invalid_file.pls"),
|
||||
@ -139,7 +139,7 @@ async def test_parse_bad_playlist(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"url,exc",
|
||||
("url", "exc"),
|
||||
(
|
||||
("http://sverigesradio.se/164-hi-aac.pls", asyncio.TimeoutError),
|
||||
("http://sverigesradio.se/164-hi-aac.pls", client_exceptions.ClientError),
|
||||
|
@ -760,7 +760,7 @@ async def test_entity_availability(hass: HomeAssistant) -> None:
|
||||
assert state.state == "unavailable"
|
||||
|
||||
|
||||
@pytest.mark.parametrize("port,entry_type", ((8009, None), (12345, None)))
|
||||
@pytest.mark.parametrize(("port", "entry_type"), ((8009, None), (12345, None)))
|
||||
async def test_device_registry(
|
||||
hass: HomeAssistant, hass_ws_client: WebSocketGenerator, port, entry_type
|
||||
) -> None:
|
||||
@ -890,7 +890,7 @@ async def test_entity_cast_status(hass: HomeAssistant) -> None:
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"cast_type,supported_features,supported_features_no_media",
|
||||
("cast_type", "supported_features", "supported_features_no_media"),
|
||||
[
|
||||
(
|
||||
pychromecast.const.CAST_TYPE_AUDIO,
|
||||
@ -1248,7 +1248,7 @@ async def test_entity_play_media_sign_URL(hass: HomeAssistant, quick_play_mock)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"url,fixture,playlist_item",
|
||||
("url", "fixture", "playlist_item"),
|
||||
(
|
||||
# Test title is extracted from m3u playlist
|
||||
(
|
||||
@ -1510,7 +1510,7 @@ async def test_entity_control(hass: HomeAssistant, quick_play_mock) -> None:
|
||||
|
||||
# Some smart TV's with Google TV report "Netflix", not the Netflix app's ID
|
||||
@pytest.mark.parametrize(
|
||||
"app_id, state_no_media",
|
||||
("app_id", "state_no_media"),
|
||||
[(pychromecast.APP_YOUTUBE, "idle"), ("Netflix", "playing")],
|
||||
)
|
||||
async def test_entity_media_states(hass: HomeAssistant, app_id, state_no_media) -> None:
|
||||
|
@ -25,7 +25,7 @@ from tests.components.blueprint.conftest import stub_blueprint_populate # noqa:
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"set_state,features_reg,features_state,expected_action_types",
|
||||
("set_state", "features_reg", "features_state", "expected_action_types"),
|
||||
[
|
||||
(False, 0, 0, ["set_hvac_mode"]),
|
||||
(
|
||||
@ -91,7 +91,7 @@ async def test_get_actions(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"hidden_by,entity_category",
|
||||
("hidden_by", "entity_category"),
|
||||
(
|
||||
(RegistryEntryHider.INTEGRATION, None),
|
||||
(RegistryEntryHider.USER, None),
|
||||
@ -200,7 +200,13 @@ async def test_action(hass: HomeAssistant) -> None:
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"set_state,capabilities_reg,capabilities_state,action,expected_capabilities",
|
||||
(
|
||||
"set_state",
|
||||
"capabilities_reg",
|
||||
"capabilities_state",
|
||||
"action",
|
||||
"expected_capabilities",
|
||||
),
|
||||
[
|
||||
(
|
||||
False,
|
||||
@ -312,7 +318,7 @@ async def test_capabilities(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"action,capability_name",
|
||||
("action", "capability_name"),
|
||||
[("set_hvac_mode", "hvac_mode"), ("set_preset_mode", "preset_mode")],
|
||||
)
|
||||
async def test_capabilities_missing_entity(
|
||||
|
@ -31,7 +31,7 @@ def calls(hass):
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"set_state,features_reg,features_state,expected_condition_types",
|
||||
("set_state", "features_reg", "features_state", "expected_condition_types"),
|
||||
[
|
||||
(False, 0, 0, ["is_hvac_mode"]),
|
||||
(
|
||||
@ -95,7 +95,7 @@ async def test_get_conditions(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"hidden_by,entity_category",
|
||||
("hidden_by", "entity_category"),
|
||||
(
|
||||
(RegistryEntryHider.INTEGRATION, None),
|
||||
(RegistryEntryHider.USER, None),
|
||||
@ -249,7 +249,13 @@ async def test_if_state(hass: HomeAssistant, calls) -> None:
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"set_state,capabilities_reg,capabilities_state,condition,expected_capabilities",
|
||||
(
|
||||
"set_state",
|
||||
"capabilities_reg",
|
||||
"capabilities_state",
|
||||
"condition",
|
||||
"expected_capabilities",
|
||||
),
|
||||
[
|
||||
(
|
||||
False,
|
||||
@ -362,7 +368,7 @@ async def test_capabilities(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"condition,capability_name",
|
||||
("condition", "capability_name"),
|
||||
[("is_hvac_mode", "hvac_mode"), ("is_preset_mode", "preset_mode")],
|
||||
)
|
||||
async def test_capabilities_missing_entity(
|
||||
|
@ -83,7 +83,7 @@ async def test_get_triggers(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"hidden_by,entity_category",
|
||||
("hidden_by", "entity_category"),
|
||||
(
|
||||
(RegistryEntryHider.INTEGRATION, None),
|
||||
(RegistryEntryHider.USER, None),
|
||||
|
@ -93,7 +93,7 @@ async def test_state_with_context(hass: HomeAssistant) -> None:
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"service,attribute",
|
||||
("service", "attribute"),
|
||||
[
|
||||
(SERVICE_SET_AUX_HEAT, ATTR_AUX_HEAT),
|
||||
(SERVICE_SET_PRESET_MODE, ATTR_PRESET_MODE),
|
||||
|
@ -170,7 +170,7 @@ async def test_alexa_config_invalidate_token(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"reject_reason,expected_exception",
|
||||
("reject_reason", "expected_exception"),
|
||||
[
|
||||
("RefreshTokenNotFound", errors.RequireRelink),
|
||||
("UnknownRegion", errors.RequireRelink),
|
||||
|
@ -135,7 +135,7 @@ async def test_handler_google_actions(hass: HomeAssistant) -> None:
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"intent,response_payload",
|
||||
("intent", "response_payload"),
|
||||
[
|
||||
("action.devices.SYNC", {"agentUserId": "myUserName", "devices": []}),
|
||||
("action.devices.QUERY", {"errorCode": "deviceTurnedOff"}),
|
||||
|
@ -131,7 +131,7 @@ async def test_form_country(hass: HomeAssistant) -> None:
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"err_str,err_code",
|
||||
("err_str", "err_code"),
|
||||
[
|
||||
("Invalid authentication credentials", "invalid_auth"),
|
||||
("API rate limit exceeded.", "api_ratelimit"),
|
||||
|
@ -317,7 +317,7 @@ async def test_reload_entry_in_setup_retry(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"type_filter,result",
|
||||
("type_filter", "result"),
|
||||
(
|
||||
(None, {"hello", "another", "world"}),
|
||||
("integration", {"hello", "another"}),
|
||||
|
@ -112,7 +112,7 @@ async def test_list_devices(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"payload_key,payload_value",
|
||||
("payload_key", "payload_value"),
|
||||
[
|
||||
["area_id", "12345A"],
|
||||
["area_id", None],
|
||||
|
@ -21,7 +21,7 @@ from tests.components.blueprint.conftest import stub_blueprint_populate # noqa:
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"set_state,features_reg,features_state,expected_action_types",
|
||||
("set_state", "features_reg", "features_state", "expected_action_types"),
|
||||
[
|
||||
(False, 0, 0, []),
|
||||
(False, CoverEntityFeature.CLOSE_TILT, 0, ["close_tilt"]),
|
||||
@ -88,7 +88,7 @@ async def test_get_actions(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"hidden_by,entity_category",
|
||||
("hidden_by", "entity_category"),
|
||||
(
|
||||
(RegistryEntryHider.INTEGRATION, None),
|
||||
(RegistryEntryHider.USER, None),
|
||||
|
@ -35,7 +35,7 @@ def calls(hass):
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"set_state,features_reg,features_state,expected_condition_types",
|
||||
("set_state", "features_reg", "features_state", "expected_condition_types"),
|
||||
[
|
||||
(False, 0, 0, []),
|
||||
(
|
||||
@ -117,7 +117,7 @@ async def test_get_conditions(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"hidden_by,entity_category",
|
||||
("hidden_by", "entity_category"),
|
||||
(
|
||||
(RegistryEntryHider.INTEGRATION, None),
|
||||
(RegistryEntryHider.USER, None),
|
||||
|
@ -38,7 +38,7 @@ def calls(hass):
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"set_state,features_reg,features_state,expected_trigger_types",
|
||||
("set_state", "features_reg", "features_state", "expected_trigger_types"),
|
||||
[
|
||||
(False, CoverEntityFeature.OPEN, 0, ["opened", "closed", "opening", "closing"]),
|
||||
(
|
||||
@ -118,7 +118,7 @@ async def test_get_triggers(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"hidden_by,entity_category",
|
||||
("hidden_by", "entity_category"),
|
||||
(
|
||||
(RegistryEntryHider.INTEGRATION, None),
|
||||
(RegistryEntryHider.USER, None),
|
||||
|
@ -78,7 +78,7 @@ async def test_abort_if_already_setup(hass: HomeAssistant, mock_daikin) -> None:
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"s_effect,reason",
|
||||
("s_effect", "reason"),
|
||||
[
|
||||
(asyncio.TimeoutError, "cannot_connect"),
|
||||
(ClientError, "cannot_connect"),
|
||||
@ -114,7 +114,7 @@ async def test_api_password_abort(hass: HomeAssistant) -> None:
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"source, data, unique_id",
|
||||
("source", "data", "unique_id"),
|
||||
[
|
||||
(
|
||||
SOURCE_ZEROCONF,
|
||||
|
@ -477,7 +477,7 @@ TEST_DATA = [
|
||||
]
|
||||
|
||||
|
||||
@pytest.mark.parametrize("sensor_data, expected", TEST_DATA)
|
||||
@pytest.mark.parametrize(("sensor_data", "expected"), TEST_DATA)
|
||||
async def test_binary_sensors(
|
||||
hass: HomeAssistant,
|
||||
aioclient_mock: AiohttpClientMocker,
|
||||
|
@ -99,7 +99,7 @@ TEST_DATA = [
|
||||
]
|
||||
|
||||
|
||||
@pytest.mark.parametrize("raw_data, expected", TEST_DATA)
|
||||
@pytest.mark.parametrize(("raw_data", "expected"), TEST_DATA)
|
||||
async def test_button(
|
||||
hass: HomeAssistant, aioclient_mock: AiohttpClientMocker, raw_data, expected
|
||||
) -> None:
|
||||
|
@ -357,7 +357,7 @@ async def test_manual_configuration_timeout_get_bridge(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"raised_error, error_string",
|
||||
("raised_error", "error_string"),
|
||||
[
|
||||
(pydeconz.errors.LinkButtonNotPressed, "linking_not_possible"),
|
||||
(asyncio.TimeoutError, "no_key"),
|
||||
|
@ -293,7 +293,7 @@ async def test_get_deconz_session(hass: HomeAssistant) -> None:
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"side_effect, raised_exception",
|
||||
("side_effect", "raised_exception"),
|
||||
[
|
||||
(asyncio.TimeoutError, CannotConnect),
|
||||
(pydeconz.RequestError, CannotConnect),
|
||||
|
@ -55,7 +55,7 @@ async def test_no_lights_or_groups(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"input,expected",
|
||||
("input", "expected"),
|
||||
[
|
||||
( # RGB light in color temp color mode
|
||||
{
|
||||
@ -373,7 +373,7 @@ async def test_light_state_change(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"input,expected",
|
||||
("input", "expected"),
|
||||
[
|
||||
( # Turn on light with hue and sat
|
||||
{
|
||||
@ -706,7 +706,7 @@ async def test_configuration_tool(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"input,expected",
|
||||
("input", "expected"),
|
||||
[
|
||||
(
|
||||
{
|
||||
@ -859,7 +859,7 @@ async def test_groups(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"input,expected",
|
||||
("input", "expected"),
|
||||
[
|
||||
( # Turn on group with short color loop
|
||||
{
|
||||
|
@ -107,7 +107,7 @@ TEST_DATA = [
|
||||
]
|
||||
|
||||
|
||||
@pytest.mark.parametrize("sensor_data, expected", TEST_DATA)
|
||||
@pytest.mark.parametrize(("sensor_data", "expected"), TEST_DATA)
|
||||
async def test_number_entities(
|
||||
hass: HomeAssistant,
|
||||
aioclient_mock: AiohttpClientMocker,
|
||||
|
@ -55,7 +55,7 @@ TEST_DATA = [
|
||||
]
|
||||
|
||||
|
||||
@pytest.mark.parametrize("raw_data, expected", TEST_DATA)
|
||||
@pytest.mark.parametrize(("raw_data", "expected"), TEST_DATA)
|
||||
async def test_scenes(
|
||||
hass: HomeAssistant, aioclient_mock: AiohttpClientMocker, raw_data, expected
|
||||
) -> None:
|
||||
|
@ -166,7 +166,7 @@ TEST_DATA = [
|
||||
]
|
||||
|
||||
|
||||
@pytest.mark.parametrize("raw_data, expected", TEST_DATA)
|
||||
@pytest.mark.parametrize(("raw_data", "expected"), TEST_DATA)
|
||||
async def test_select(
|
||||
hass: HomeAssistant, aioclient_mock: AiohttpClientMocker, raw_data, expected
|
||||
) -> None:
|
||||
|
@ -619,7 +619,7 @@ TEST_DATA = [
|
||||
]
|
||||
|
||||
|
||||
@pytest.mark.parametrize("sensor_data, expected", TEST_DATA)
|
||||
@pytest.mark.parametrize(("sensor_data", "expected"), TEST_DATA)
|
||||
async def test_sensors(
|
||||
hass: HomeAssistant,
|
||||
aioclient_mock: AiohttpClientMocker,
|
||||
@ -829,7 +829,7 @@ BAD_SENSOR_DATA = [
|
||||
]
|
||||
|
||||
|
||||
@pytest.mark.parametrize("sensor_type, sensor_property", BAD_SENSOR_DATA)
|
||||
@pytest.mark.parametrize(("sensor_type", "sensor_property"), BAD_SENSOR_DATA)
|
||||
async def test_dont_add_sensor_if_state_is_none(
|
||||
hass: HomeAssistant,
|
||||
aioclient_mock: AiohttpClientMocker,
|
||||
|
@ -12,7 +12,7 @@ from homeassistant.setup import async_setup_component
|
||||
from tests.common import mock_restore_cache_with_extra_data
|
||||
|
||||
|
||||
@pytest.mark.parametrize("entity_id, delta", (("sensor.total_energy_kwh", 0.5),))
|
||||
@pytest.mark.parametrize(("entity_id", "delta"), (("sensor.total_energy_kwh", 0.5),))
|
||||
async def test_energy_sensor(hass: HomeAssistant, entity_id, delta, freezer) -> None:
|
||||
"""Test energy sensors increase periodically."""
|
||||
assert await async_setup_component(
|
||||
@ -31,7 +31,7 @@ async def test_energy_sensor(hass: HomeAssistant, entity_id, delta, freezer) ->
|
||||
assert state.state == str(delta)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("entity_id, delta", (("sensor.total_energy_kwh", 0.5),))
|
||||
@pytest.mark.parametrize(("entity_id", "delta"), (("sensor.total_energy_kwh", 0.5),))
|
||||
async def test_restore_state(hass: HomeAssistant, entity_id, delta, freezer) -> None:
|
||||
"""Test energy sensors restore state."""
|
||||
fake_state = ha.State(
|
||||
|
@ -58,7 +58,7 @@ async def test_get_conditions(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"hidden_by,entity_category",
|
||||
("hidden_by", "entity_category"),
|
||||
(
|
||||
(RegistryEntryHider.INTEGRATION, None),
|
||||
(RegistryEntryHider.USER, None),
|
||||
|
@ -89,7 +89,7 @@ async def test_get_triggers(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"hidden_by,entity_category",
|
||||
("hidden_by", "entity_category"),
|
||||
(
|
||||
(RegistryEntryHider.INTEGRATION, None),
|
||||
(RegistryEntryHider.USER, None),
|
||||
|
@ -62,7 +62,7 @@ async def test_form(hass: HomeAssistant, info: dict[str, Any]):
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"exception_type, expected_error",
|
||||
("exception_type", "expected_error"),
|
||||
[[DeviceNotFound, "cannot_connect"], [Exception, "unknown"]],
|
||||
)
|
||||
async def test_form_error(hass: HomeAssistant, exception_type, expected_error) -> None:
|
||||
|
@ -240,7 +240,7 @@ async def test_update_enable_leds(hass: HomeAssistant, mock_device: MockDevice)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"name, get_method, update_interval",
|
||||
("name", "get_method", "update_interval"),
|
||||
[
|
||||
["enable_guest_wifi", "async_get_wifi_guest_access", SHORT_UPDATE_INTERVAL],
|
||||
["enable_leds", "async_get_led_setting", SHORT_UPDATE_INTERVAL],
|
||||
@ -275,7 +275,7 @@ async def test_device_failure(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"name, set_method",
|
||||
("name", "set_method"),
|
||||
[
|
||||
["enable_guest_wifi", "async_set_wifi_guest_access"],
|
||||
["enable_leds", "async_set_led_setting"],
|
||||
|
@ -220,7 +220,7 @@ async def test_bluetooth_step_already_in_progress(hass: HomeAssistant) -> None:
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"exc, error",
|
||||
("exc", "error"),
|
||||
(
|
||||
(BleakError, "cannot_connect"),
|
||||
(Exception, "unknown"),
|
||||
@ -259,7 +259,7 @@ async def test_bluetooth_step_cannot_connect(hass: HomeAssistant, exc, error) ->
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"exc, error",
|
||||
("exc", "error"),
|
||||
(
|
||||
(dkey_errors.InvalidActivationCode, "invalid_code"),
|
||||
(dkey_errors.WrongActivationCode, "wrong_code"),
|
||||
|
@ -12,7 +12,7 @@ from tests.common import MockConfigEntry
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"dsmr_version,old_unique_id,new_unique_id",
|
||||
("dsmr_version", "old_unique_id", "new_unique_id"),
|
||||
[
|
||||
("5", "1234_Power_Consumption", "1234_current_electricity_usage"),
|
||||
("5", "1234_Power_Production", "1234_current_electricity_delivery"),
|
||||
|
@ -11,7 +11,7 @@ from tests.common import MockConfigEntry
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"first_con, second_con,exp_type, exp_result, exp_reason",
|
||||
("first_con", "second_con", "exp_type", "exp_result", "exp_reason"),
|
||||
[
|
||||
(True, True, "create_entry", config_entries.ConfigEntryState.LOADED, ""),
|
||||
(False, False, "abort", None, "no_connection"),
|
||||
|
@ -48,7 +48,7 @@ async def test_switch_setup(hass: HomeAssistant, mock_device) -> None:
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("saved_state, level", [(STATE_ON, 1), (STATE_OFF, 0)])
|
||||
@pytest.mark.parametrize(("saved_state", "level"), [(STATE_ON, 1), (STATE_OFF, 0)])
|
||||
async def test_switch_restore_state(
|
||||
hass: HomeAssistant, mock_device, saved_state, level
|
||||
) -> None:
|
||||
|
@ -976,7 +976,7 @@ async def test_form_import_existing(hass: HomeAssistant) -> None:
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"source, data",
|
||||
("source", "data"),
|
||||
[
|
||||
(config_entries.SOURCE_DHCP, DHCP_DISCOVERY),
|
||||
(config_entries.SOURCE_INTEGRATION_DISCOVERY, ELK_DISCOVERY_INFO),
|
||||
@ -1006,7 +1006,7 @@ async def test_discovered_by_dhcp_or_discovery_mac_address_mismatch_host_already
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"source, data",
|
||||
("source", "data"),
|
||||
[
|
||||
(config_entries.SOURCE_DHCP, DHCP_DISCOVERY),
|
||||
(config_entries.SOURCE_INTEGRATION_DISCOVERY, ELK_DISCOVERY_INFO),
|
||||
|
@ -439,7 +439,7 @@ async def test_light_without_brightness_can_be_turned_on(hass_hue, hue_client) -
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"state,is_reachable",
|
||||
("state", "is_reachable"),
|
||||
[
|
||||
(const.STATE_UNAVAILABLE, False),
|
||||
(const.STATE_OK, True),
|
||||
|
@ -134,7 +134,9 @@ async def test_cost_sensor_attributes(
|
||||
assert entry.hidden_by == er.RegistryEntryHider.INTEGRATION
|
||||
|
||||
|
||||
@pytest.mark.parametrize("initial_energy,initial_cost", [(0, "0.0"), (None, "unknown")])
|
||||
@pytest.mark.parametrize(
|
||||
("initial_energy", "initial_cost"), [(0, "0.0"), (None, "unknown")]
|
||||
)
|
||||
@pytest.mark.parametrize(
|
||||
"price_entity,fixed_price", [("sensor.energy_price", None), (None, 1)]
|
||||
)
|
||||
@ -336,7 +338,9 @@ async def test_cost_sensor_price_entity_total_increasing(
|
||||
assert statistics["stat"]["sum"] == 38.0
|
||||
|
||||
|
||||
@pytest.mark.parametrize("initial_energy,initial_cost", [(0, "0.0"), (None, "unknown")])
|
||||
@pytest.mark.parametrize(
|
||||
("initial_energy", "initial_cost"), [(0, "0.0"), (None, "unknown")]
|
||||
)
|
||||
@pytest.mark.parametrize(
|
||||
"price_entity,fixed_price", [("sensor.energy_price", None), (None, 1)]
|
||||
)
|
||||
@ -542,7 +546,9 @@ async def test_cost_sensor_price_entity_total(
|
||||
assert statistics["stat"]["sum"] == 38.0
|
||||
|
||||
|
||||
@pytest.mark.parametrize("initial_energy,initial_cost", [(0, "0.0"), (None, "unknown")])
|
||||
@pytest.mark.parametrize(
|
||||
("initial_energy", "initial_cost"), [(0, "0.0"), (None, "unknown")]
|
||||
)
|
||||
@pytest.mark.parametrize(
|
||||
"price_entity,fixed_price", [("sensor.energy_price", None), (None, 1)]
|
||||
)
|
||||
@ -724,7 +730,7 @@ async def test_cost_sensor_price_entity_total_no_reset(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"energy_unit,factor",
|
||||
("energy_unit", "factor"),
|
||||
[
|
||||
(UnitOfEnergy.WATT_HOUR, 1000),
|
||||
(UnitOfEnergy.KILO_WATT_HOUR, 1),
|
||||
@ -794,7 +800,7 @@ async def test_cost_sensor_handle_energy_units(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"price_unit,factor",
|
||||
("price_unit", "factor"),
|
||||
[
|
||||
(f"EUR/{UnitOfEnergy.WATT_HOUR}", 0.001),
|
||||
(f"EUR/{UnitOfEnergy.KILO_WATT_HOUR}", 1),
|
||||
@ -973,7 +979,7 @@ async def test_cost_sensor_handle_gas_kwh(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"unit_system,usage_unit,growth",
|
||||
("unit_system", "usage_unit", "growth"),
|
||||
(
|
||||
# 1 cubic foot = 7.47 gl, 100 ft3 growth @ 0.5/ft3:
|
||||
(US_CUSTOMARY_SYSTEM, UnitOfVolume.CUBIC_FEET, 374.025974025974),
|
||||
|
@ -62,7 +62,7 @@ async def test_validation_empty_config(hass: HomeAssistant) -> None:
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"state_class, energy_unit, extra",
|
||||
("state_class", "energy_unit", "extra"),
|
||||
[
|
||||
("total_increasing", UnitOfEnergy.KILO_WATT_HOUR, {}),
|
||||
("total_increasing", UnitOfEnergy.MEGA_WATT_HOUR, {}),
|
||||
@ -688,7 +688,7 @@ async def test_validation_grid_auto_cost_entity_errors(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"state, unit, expected",
|
||||
("state", "unit", "expected"),
|
||||
(
|
||||
(
|
||||
"123,123.12",
|
||||
|
@ -18,7 +18,7 @@ def stub_reconnect():
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"devices_payload,expected_state,expected_attributes",
|
||||
("devices_payload", "expected_state", "expected_attributes"),
|
||||
[
|
||||
(
|
||||
[
|
||||
|
@ -52,7 +52,7 @@ async def test_get_actions(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"hidden_by,entity_category",
|
||||
("hidden_by", "entity_category"),
|
||||
(
|
||||
(RegistryEntryHider.INTEGRATION, None),
|
||||
(RegistryEntryHider.USER, None),
|
||||
|
@ -58,7 +58,7 @@ async def test_get_conditions(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"hidden_by,entity_category",
|
||||
("hidden_by", "entity_category"),
|
||||
(
|
||||
(RegistryEntryHider.INTEGRATION, None),
|
||||
(RegistryEntryHider.USER, None),
|
||||
|
@ -63,7 +63,7 @@ async def test_get_triggers(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"hidden_by,entity_category",
|
||||
("hidden_by", "entity_category"),
|
||||
(
|
||||
(RegistryEntryHider.INTEGRATION, None),
|
||||
(RegistryEntryHider.USER, None),
|
||||
|
@ -66,7 +66,7 @@ async def test_async_fanentity(hass: HomeAssistant) -> None:
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"attribute_name, attribute_value",
|
||||
("attribute_name", "attribute_value"),
|
||||
[
|
||||
("current_direction", "forward"),
|
||||
("oscillating", True),
|
||||
|
@ -563,7 +563,7 @@ async def test_discovered_by_dhcp_no_udp_response_or_tcp_response(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"source, data",
|
||||
("source", "data"),
|
||||
[
|
||||
(config_entries.SOURCE_DHCP, DHCP_DISCOVERY),
|
||||
(config_entries.SOURCE_INTEGRATION_DISCOVERY, FLUX_DISCOVERY),
|
||||
@ -633,7 +633,7 @@ async def test_mac_address_off_by_one_not_updated_from_dhcp(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"source, data",
|
||||
("source", "data"),
|
||||
[
|
||||
(config_entries.SOURCE_DHCP, DHCP_DISCOVERY),
|
||||
(config_entries.SOURCE_INTEGRATION_DISCOVERY, FLUX_DISCOVERY),
|
||||
@ -700,7 +700,7 @@ async def test_options(hass: HomeAssistant) -> None:
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"source, data",
|
||||
("source", "data"),
|
||||
[
|
||||
(config_entries.SOURCE_DHCP, DHCP_DISCOVERY),
|
||||
(config_entries.SOURCE_INTEGRATION_DISCOVERY, FLUX_DISCOVERY),
|
||||
|
@ -182,7 +182,7 @@ async def test_coordinator_retry_right_away_on_discovery_already_setup(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"discovery,title",
|
||||
("discovery", "title"),
|
||||
[
|
||||
(FLUX_DISCOVERY, DEFAULT_ENTRY_TITLE),
|
||||
(FLUX_DISCOVERY_PARTIAL, DEFAULT_ENTRY_TITLE),
|
||||
|
@ -154,7 +154,7 @@ async def test_light_mac_address_not_found(hass: HomeAssistant) -> None:
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"protocol,sw_version,model_num,model",
|
||||
("protocol", "sw_version", "model_num", "model"),
|
||||
[
|
||||
("LEDENET_ORIGINAL", 1, 0x01, "Original LEDEDNET (0x35)"),
|
||||
("LEDENET", 8, 0x33, "Magic Home Branded RGB Controller (0x33)"),
|
||||
|
@ -173,7 +173,7 @@ async def test_disabled_by_default(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"key,name,value",
|
||||
("key", "name", "value"),
|
||||
[
|
||||
(
|
||||
"power_production_next_12hours",
|
||||
|
@ -15,7 +15,7 @@ from tests.common import async_fire_time_changed
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"entity_id, uid, name, model",
|
||||
("entity_id", "uid", "name", "model"),
|
||||
[
|
||||
(
|
||||
"binary_sensor.doorway_motion_sensor",
|
||||
|
@ -24,7 +24,7 @@ from tests.common import async_fire_time_changed
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"entity_id, uid, name, model",
|
||||
("entity_id", "uid", "name", "model"),
|
||||
[
|
||||
(
|
||||
"cover.blind",
|
||||
@ -84,7 +84,7 @@ async def test_cover_get_state(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"entity_id, uid, name, model",
|
||||
("entity_id", "uid", "name", "model"),
|
||||
[
|
||||
(
|
||||
"cover.blind",
|
||||
@ -139,7 +139,7 @@ async def test_cover_set_position(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"entity_id, uid, name, model",
|
||||
("entity_id", "uid", "name", "model"),
|
||||
[
|
||||
(
|
||||
"cover.blind",
|
||||
@ -202,7 +202,7 @@ async def test_cover_close(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"entity_id, uid, name, model",
|
||||
("entity_id", "uid", "name", "model"),
|
||||
[
|
||||
(
|
||||
"cover.blind",
|
||||
|
@ -14,7 +14,7 @@ from tests.common import async_fire_time_changed
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"entity_id, uid, name",
|
||||
("entity_id", "uid", "name"),
|
||||
[
|
||||
(
|
||||
"sensor.garden_humidity_sensor",
|
||||
|
@ -33,7 +33,7 @@ async def test_button_setup(hass: HomeAssistant, fc_class_mock, fh_class_mock) -
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"entity_id, wrapper_method",
|
||||
("entity_id", "wrapper_method"),
|
||||
[
|
||||
("button.mock_title_firmware_update", "async_trigger_firmware_update"),
|
||||
("button.mock_title_reboot", "async_trigger_reboot"),
|
||||
|
@ -246,7 +246,7 @@ async def test_reauth_successful(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"side_effect,error",
|
||||
("side_effect", "error"),
|
||||
[
|
||||
(FritzAuthorizationError, ERROR_AUTH_INVALID),
|
||||
(FritzConnectionException, ERROR_CANNOT_CONNECT),
|
||||
|
@ -154,7 +154,7 @@ MOCK_WLANCONFIGS_DIFF2_SSID: dict[str, dict] = {
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"fc_data, expected_wifi_names",
|
||||
("fc_data", "expected_wifi_names"),
|
||||
[
|
||||
(
|
||||
{**MOCK_FB_SERVICES, **MOCK_WLANCONFIGS_SAME_SSID},
|
||||
|
@ -201,7 +201,7 @@ async def test_reauth_not_successful(hass: HomeAssistant, fritz: Mock) -> None:
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"test_data,expected_result",
|
||||
("test_data", "expected_result"),
|
||||
[
|
||||
(MOCK_SSDP_DATA["ip4_valid"], FlowResultType.FORM),
|
||||
(MOCK_SSDP_DATA["ip6_valid"], FlowResultType.FORM),
|
||||
|
@ -46,7 +46,7 @@ async def test_setup(hass: HomeAssistant, fritz: Mock) -> None:
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"entitydata,old_unique_id,new_unique_id",
|
||||
("entitydata", "old_unique_id", "new_unique_id"),
|
||||
[
|
||||
(
|
||||
{
|
||||
@ -99,7 +99,7 @@ async def test_update_unique_id(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"entitydata,unique_id",
|
||||
("entitydata", "unique_id"),
|
||||
[
|
||||
(
|
||||
{
|
||||
|
@ -53,7 +53,7 @@ async def test_user_flow(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"side_effect,reason",
|
||||
("side_effect", "reason"),
|
||||
[
|
||||
(FullyKioskError("error", "status"), "cannot_connect"),
|
||||
(ClientConnectorError(None, Mock()), "cannot_connect"),
|
||||
|
@ -37,7 +37,7 @@ async def test_full_flow(hass: HomeAssistant) -> None:
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"side_effect,reason",
|
||||
("side_effect", "reason"),
|
||||
[
|
||||
(RuntimeError, "unknown"),
|
||||
(
|
||||
|
@ -304,7 +304,7 @@ async def test_set_target_temp(hass: HomeAssistant, setup_comp_2) -> None:
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"preset,temp",
|
||||
("preset", "temp"),
|
||||
[
|
||||
(PRESET_NONE, 23),
|
||||
(PRESET_AWAY, 16),
|
||||
@ -323,7 +323,7 @@ async def test_set_away_mode(hass: HomeAssistant, setup_comp_2, preset, temp) ->
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"preset,temp",
|
||||
("preset", "temp"),
|
||||
[
|
||||
(PRESET_NONE, 23),
|
||||
(PRESET_AWAY, 16),
|
||||
@ -350,7 +350,7 @@ async def test_set_away_mode_and_restore_prev_temp(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"preset,temp",
|
||||
("preset", "temp"),
|
||||
[
|
||||
(PRESET_NONE, 23),
|
||||
(PRESET_AWAY, 16),
|
||||
|
@ -548,7 +548,7 @@ async def test_http_api_all_day_event(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"calendars_config_ignore_availability,transparency,expect_visible_event",
|
||||
("calendars_config_ignore_availability", "transparency", "expect_visible_event"),
|
||||
[
|
||||
# Look at visibility to determine if entity is created
|
||||
(False, "opaque", True),
|
||||
@ -798,7 +798,7 @@ async def test_invalid_unique_id_cleanup(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"time_zone,event_order,calendar_access_role",
|
||||
("time_zone", "event_order", "calendar_access_role"),
|
||||
# This only tests the reader role to force testing against the local
|
||||
# database filtering based on start/end time. (free busy reader would
|
||||
# just use the API response which this test is not exercising)
|
||||
@ -1075,7 +1075,7 @@ async def test_websocket_delete_recurring_event_instance(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"calendar_access_role,token_scopes,config_entry_options",
|
||||
("calendar_access_role", "token_scopes", "config_entry_options"),
|
||||
[
|
||||
(
|
||||
"reader",
|
||||
|
@ -525,7 +525,7 @@ async def test_reauth_flow(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"primary_calendar_error,primary_calendar_status,reason",
|
||||
("primary_calendar_error", "primary_calendar_status", "reason"),
|
||||
[
|
||||
(ClientError(), None, "cannot_connect"),
|
||||
(None, HTTPStatus.FORBIDDEN, "api_disabled"),
|
||||
|
@ -297,7 +297,7 @@ async def test_multiple_config_entries(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"date_fields,expected_error,error_match",
|
||||
("date_fields", "expected_error", "error_match"),
|
||||
[
|
||||
(
|
||||
{},
|
||||
@ -436,7 +436,7 @@ async def test_add_event_invalid_params(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"date_fields,start_timedelta,end_timedelta",
|
||||
("date_fields", "start_timedelta", "end_timedelta"),
|
||||
[
|
||||
(
|
||||
{"in": {"days": 3}},
|
||||
@ -682,7 +682,7 @@ async def test_expired_token_requires_reauth(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"calendars_config,expect_write_calls",
|
||||
("calendars_config", "expect_write_calls"),
|
||||
[
|
||||
(
|
||||
[
|
||||
@ -799,7 +799,7 @@ async def test_assign_unique_id(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"config_entry_unique_id,request_status,config_entry_status",
|
||||
("config_entry_unique_id", "request_status", "config_entry_status"),
|
||||
[
|
||||
(None, http.HTTPStatus.BAD_REQUEST, ConfigEntryState.SETUP_RETRY),
|
||||
(
|
||||
|
@ -315,7 +315,7 @@ async def test_report_state_all(agents) -> None:
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"agents, result",
|
||||
("agents", "result"),
|
||||
[({}, 204), ({"1": 200}, 200), ({"1": 200, "2": 300}, 300)],
|
||||
)
|
||||
async def test_sync_entities_all(agents, result) -> None:
|
||||
|
@ -441,7 +441,8 @@ async def test_query_message(hass: HomeAssistant) -> None:
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"report_state,on,brightness,value", [(False, True, 20, 0.2), (True, ANY, ANY, ANY)]
|
||||
("report_state", "on", "brightness", "value"),
|
||||
[(False, True, 20, 0.2), (True, ANY, ANY, ANY)],
|
||||
)
|
||||
async def test_execute(
|
||||
hass: HomeAssistant, report_state, on, brightness, value
|
||||
@ -621,7 +622,9 @@ async def test_execute(
|
||||
assert service_events[3].context == events[0].context
|
||||
|
||||
|
||||
@pytest.mark.parametrize("report_state,on,brightness,value", [(False, False, ANY, ANY)])
|
||||
@pytest.mark.parametrize(
|
||||
("report_state", "on", "brightness", "value"), [(False, False, ANY, ANY)]
|
||||
)
|
||||
async def test_execute_times_out(
|
||||
hass: HomeAssistant, report_state, on, brightness, value
|
||||
) -> None:
|
||||
@ -998,7 +1001,7 @@ async def test_unavailable_state_does_sync(hass: HomeAssistant) -> None:
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"device_class,google_type",
|
||||
("device_class", "google_type"),
|
||||
[
|
||||
("non_existing_class", "action.devices.types.SWITCH"),
|
||||
("switch", "action.devices.types.SWITCH"),
|
||||
@ -1048,7 +1051,7 @@ async def test_device_class_switch(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"device_class,google_type",
|
||||
("device_class", "google_type"),
|
||||
[
|
||||
("door", "action.devices.types.DOOR"),
|
||||
("garage_door", "action.devices.types.GARAGE"),
|
||||
@ -1098,7 +1101,7 @@ async def test_device_class_binary_sensor(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"device_class,google_type",
|
||||
("device_class", "google_type"),
|
||||
[
|
||||
("non_existing_class", "action.devices.types.BLINDS"),
|
||||
("door", "action.devices.types.DOOR"),
|
||||
@ -1148,7 +1151,7 @@ async def test_device_class_cover(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"device_class,google_type",
|
||||
("device_class", "google_type"),
|
||||
[
|
||||
("non_existing_class", "action.devices.types.SETTOP"),
|
||||
("tv", "action.devices.types.TV"),
|
||||
|
@ -1647,7 +1647,7 @@ async def test_fan_speed_without_percentage_step(hass: HomeAssistant) -> None:
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"percentage,percentage_step, speed, speeds, percentage_result",
|
||||
("percentage", "percentage_step", "speed", "speeds", "percentage_result"),
|
||||
[
|
||||
(
|
||||
33,
|
||||
@ -1758,7 +1758,7 @@ async def test_fan_speed_ordered(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"direction_state,direction_call",
|
||||
("direction_state", "direction_call"),
|
||||
[
|
||||
(fan.DIRECTION_FORWARD, fan.DIRECTION_REVERSE),
|
||||
(fan.DIRECTION_REVERSE, fan.DIRECTION_FORWARD),
|
||||
@ -1935,7 +1935,7 @@ async def test_inputselector(hass: HomeAssistant) -> None:
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"sources,source,source_next,source_prev",
|
||||
("sources", "source", "source_next", "source_prev"),
|
||||
[
|
||||
(["a"], "a", "a", "a"),
|
||||
(["a", "b"], "a", "b", "b"),
|
||||
@ -1990,7 +1990,7 @@ async def test_inputselector_nextprev(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"sources,source", [(None, "a"), (["a", "b"], None), (["a", "b"], "c")]
|
||||
("sources", "source"), [(None, "a"), (["a", "b"], None), (["a", "b"], "c")]
|
||||
)
|
||||
async def test_inputselector_nextprev_invalid(
|
||||
hass: HomeAssistant, sources, source
|
||||
@ -2916,7 +2916,7 @@ async def test_temperature_control_sensor(hass: HomeAssistant) -> None:
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"unit_in,unit_out,state,ambient",
|
||||
("unit_in", "unit_out", "state", "ambient"),
|
||||
[
|
||||
(UnitOfTemperature.FAHRENHEIT, "F", "70", 21.1),
|
||||
(UnitOfTemperature.CELSIUS, "C", "21.1", 21.1),
|
||||
@ -2971,7 +2971,7 @@ async def test_humidity_setting_sensor(hass: HomeAssistant) -> None:
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"state,ambient", [("70", 70), ("unavailable", None), ("unknown", None)]
|
||||
("state", "ambient"), [("70", 70), ("unavailable", None), ("unknown", None)]
|
||||
)
|
||||
async def test_humidity_setting_sensor_data(
|
||||
hass: HomeAssistant, state, ambient
|
||||
|
@ -85,7 +85,7 @@ async def test_expired_token_refresh_success(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"expires_at,status,expected_state",
|
||||
("expires_at", "status", "expected_state"),
|
||||
[
|
||||
(
|
||||
time.time() - 3600,
|
||||
@ -122,7 +122,7 @@ async def test_expired_token_refresh_failure(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"configured_language_code,expected_language_code",
|
||||
("configured_language_code", "expected_language_code"),
|
||||
[("", "en-US"), ("en-US", "en-US"), ("es-ES", "es-ES")],
|
||||
ids=["default", "english", "spanish"],
|
||||
)
|
||||
@ -187,7 +187,7 @@ async def test_send_text_commands(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"status,requires_reauth",
|
||||
("status", "requires_reauth"),
|
||||
[
|
||||
(
|
||||
http.HTTPStatus.UNAUTHORIZED,
|
||||
|
@ -13,7 +13,7 @@ from .conftest import ComponentSetup, ExpectedCredentials
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"language_code,message,expected_command",
|
||||
("language_code", "message", "expected_command"),
|
||||
[
|
||||
("en-US", "Dinner is served", "broadcast Dinner is served"),
|
||||
("es-ES", "La cena está en la mesa", "Anuncia La cena está en la mesa"),
|
||||
@ -51,7 +51,7 @@ async def test_broadcast_no_targets(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"language_code,message,target,expected_command",
|
||||
("language_code", "message", "target", "expected_command"),
|
||||
[
|
||||
(
|
||||
"en-US",
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user