Enable Ruff rule PT007 (#113764)

Co-authored-by: Franck Nijhof <frenck@frenck.nl>
This commit is contained in:
Sid 2024-03-19 09:01:07 +01:00 committed by GitHub
parent 089a3ab6d7
commit 00ec7f11f0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
204 changed files with 908 additions and 921 deletions

View file

@ -658,6 +658,7 @@ ignore = [
"PLR0915", # Too many statements ({statements} > {max_statements})
"PLR2004", # Magic value used in comparison, consider replacing {value} with a constant variable
"PLW2901", # Outer {outer_kind} variable {name} overwritten by inner {inner_kind} target
"PT004", # Fixture {fixture} does not return anything, add leading underscore
"SIM102", # Use a single if statement instead of nested if statements
"SIM108", # Use ternary operator {contents} instead of if-else-block
"SIM115", # Use context handler for opening files
@ -682,8 +683,6 @@ ignore = [
"PLE0605",
# temporarily disabled
"PT004",
"PT007",
"PT011",
"PT018",
"PT012",

View file

@ -14,7 +14,7 @@ from tests.common import MockConfigEntry
pytestmark = pytest.mark.usefixtures("mock_setup_entry")
@pytest.mark.parametrize("platform", ("sensor",))
@pytest.mark.parametrize("platform", ["sensor"])
async def test_config_flow(
hass: HomeAssistant, mock_setup_entry: AsyncMock, platform
) -> None:
@ -62,7 +62,7 @@ def get_suggested(schema, key):
raise Exception
@pytest.mark.parametrize("platform", ("sensor",))
@pytest.mark.parametrize("platform", ["sensor"])
async def test_options(hass: HomeAssistant, platform) -> None:
"""Test reconfiguring."""
input_sensor_1_entity_id = "sensor.input1"

View file

@ -9,7 +9,7 @@ from homeassistant.helpers import entity_registry as er
from tests.common import MockConfigEntry
@pytest.mark.parametrize("platform", ("sensor",))
@pytest.mark.parametrize("platform", ["sensor"])
async def test_setup_and_remove_config_entry(
hass: HomeAssistant,
platform: str,

View file

@ -50,12 +50,12 @@ async def test_get_actions(
@pytest.mark.parametrize(
("hidden_by", "entity_category"),
(
[
(er.RegistryEntryHider.INTEGRATION, None),
(er.RegistryEntryHider.USER, None),
(None, EntityCategory.CONFIG),
(None, EntityCategory.DIAGNOSTIC),
),
],
)
async def test_get_actions_hidden_auxiliary(
hass: HomeAssistant,

View file

@ -196,7 +196,7 @@ async def test_unload_entry(
assert not hass.data.get(DOMAIN)
@pytest.mark.parametrize("old_identifier", ((DOMAIN, 123, 456), (DOMAIN, "123", "456")))
@pytest.mark.parametrize("old_identifier", [(DOMAIN, 123, 456), (DOMAIN, "123", "456")])
async def test_migrate_device_entry(
hass: HomeAssistant,
aioclient_mock: AiohttpClientMocker,

View file

@ -132,12 +132,12 @@ async def test_get_actions(
@pytest.mark.parametrize(
("hidden_by", "entity_category"),
(
[
(er.RegistryEntryHider.INTEGRATION, None),
(er.RegistryEntryHider.USER, None),
(None, EntityCategory.CONFIG),
(None, EntityCategory.DIAGNOSTIC),
),
],
)
async def test_get_actions_hidden_auxiliary(
hass: HomeAssistant,

View file

@ -139,12 +139,12 @@ async def test_get_conditions(
@pytest.mark.parametrize(
("hidden_by", "entity_category"),
(
[
(er.RegistryEntryHider.INTEGRATION, None),
(er.RegistryEntryHider.USER, None),
(None, EntityCategory.CONFIG),
(None, EntityCategory.DIAGNOSTIC),
),
],
)
async def test_get_conditions_hidden_auxiliary(
hass: HomeAssistant,

View file

@ -131,12 +131,12 @@ async def test_get_triggers(
@pytest.mark.parametrize(
("hidden_by", "entity_category"),
(
[
(er.RegistryEntryHider.INTEGRATION, None),
(er.RegistryEntryHider.USER, None),
(None, EntityCategory.CONFIG),
(None, EntityCategory.DIAGNOSTIC),
),
],
)
async def test_get_triggers_hidden_auxiliary(
hass: HomeAssistant,

View file

@ -21,7 +21,7 @@ from tests.common import MockConfigEntry, async_fire_time_changed
@pytest.mark.parametrize(
"status",
(
[
# Contains "SERIALNO" and "UPSNAME" fields.
# We should create devices for the entities and prefix their IDs with "MyUPS".
MOCK_STATUS,
@ -31,7 +31,7 @@ from tests.common import MockConfigEntry, async_fire_time_changed
# Does not contain either "SERIALNO" field.
# We should _not_ create devices for the entities and their IDs will not have prefixes.
MOCK_MINIMAL_STATUS,
),
],
)
async def test_async_setup_entry(hass: HomeAssistant, status: OrderedDict) -> None:
"""Test a successful setup entry."""
@ -53,7 +53,7 @@ async def test_async_setup_entry(hass: HomeAssistant, status: OrderedDict) -> No
@pytest.mark.parametrize(
"status",
(
[
# We should not create device entries if SERIALNO is not reported.
MOCK_MINIMAL_STATUS,
# We should set the device name to be the friendly UPSNAME field if available.
@ -62,7 +62,7 @@ async def test_async_setup_entry(hass: HomeAssistant, status: OrderedDict) -> No
MOCK_MINIMAL_STATUS | {"SERIALNO": "XXXX"},
# We should create all fields of the device entry if they are available.
MOCK_STATUS,
),
],
)
async def test_device_entry(
hass: HomeAssistant, status: OrderedDict, device_registry: dr.DeviceRegistry
@ -139,7 +139,7 @@ async def test_multiple_integrations_different_devices(hass: HomeAssistant) -> N
@pytest.mark.parametrize(
"error",
(OSError(), asyncio.IncompleteReadError(partial=b"", expected=0)),
[OSError(), asyncio.IncompleteReadError(partial=b"", expected=0)],
)
async def test_connection_error(hass: HomeAssistant, error: Exception) -> None:
"""Test connection error during integration setup."""

View file

@ -754,7 +754,7 @@ async def test_automation_stops(hass: HomeAssistant, calls, service) -> None:
assert len(calls) == (1 if service == "turn_off_no_stop" else 0)
@pytest.mark.parametrize("extra_config", ({}, {"id": "sun"}))
@pytest.mark.parametrize("extra_config", [{}, {"id": "sun"}])
async def test_reload_unchanged_does_not_stop(
hass: HomeAssistant, calls, extra_config
) -> None:
@ -962,7 +962,7 @@ async def test_reload_identical_automations_without_id(
@pytest.mark.parametrize(
"automation_config",
(
[
{
"trigger": {"platform": "event", "event_type": "test_event"},
"action": [{"service": "test.automation"}],
@ -1029,7 +1029,7 @@ async def test_reload_identical_automations_without_id(
},
},
},
),
],
)
async def test_reload_unchanged_automation(
hass: HomeAssistant, calls, automation_config
@ -1065,7 +1065,7 @@ async def test_reload_unchanged_automation(
assert len(calls) == 2
@pytest.mark.parametrize("extra_config", ({}, {"id": "sun"}))
@pytest.mark.parametrize("extra_config", [{}, {"id": "sun"}])
async def test_reload_automation_when_blueprint_changes(
hass: HomeAssistant, calls, extra_config
) -> None:
@ -1362,7 +1362,7 @@ async def test_automation_not_trigger_on_bootstrap(hass: HomeAssistant) -> None:
@pytest.mark.parametrize(
("broken_config", "problem", "details"),
(
[
(
{},
"could not be validated",
@ -1403,7 +1403,7 @@ async def test_automation_not_trigger_on_bootstrap(hass: HomeAssistant) -> None:
"failed to setup actions",
"Unknown entity registry entry abcdabcdabcdabcdabcdabcdabcdabcd.",
),
),
],
)
async def test_automation_bad_config_validation(
hass: HomeAssistant,
@ -2141,7 +2141,7 @@ async def test_blueprint_automation(hass: HomeAssistant, calls) -> None:
@pytest.mark.parametrize(
("blueprint_inputs", "problem", "details"),
(
[
(
# No input
{},
@ -2167,7 +2167,7 @@ async def test_blueprint_automation(hass: HomeAssistant, calls) -> None:
" data['action'][0]['service']"
),
),
),
],
)
async def test_blueprint_automation_bad_config(
hass: HomeAssistant,
@ -2350,21 +2350,21 @@ async def test_trigger_condition_explicit_id(hass: HomeAssistant, calls) -> None
@pytest.mark.parametrize(
("automation_mode", "automation_runs"),
(
[
(SCRIPT_MODE_PARALLEL, 2),
(SCRIPT_MODE_QUEUED, 2),
(SCRIPT_MODE_RESTART, 2),
(SCRIPT_MODE_SINGLE, 1),
),
],
)
@pytest.mark.parametrize(
("script_mode", "script_warning_msg"),
(
[
(SCRIPT_MODE_PARALLEL, "script1: Maximum number of runs exceeded"),
(SCRIPT_MODE_QUEUED, "script1: Disallowed recursion detected"),
(SCRIPT_MODE_RESTART, "script1: Disallowed recursion detected"),
(SCRIPT_MODE_SINGLE, "script1: Already running"),
),
],
)
@pytest.mark.parametrize("wait_for_stop_scripts_after_shutdown", [True])
async def test_recursive_automation_starting_script(

View file

@ -27,10 +27,10 @@ def sync_access_token_proxy(
@pytest.mark.parametrize(
"with_hassio",
(
[
pytest.param(True, id="with_hassio"),
pytest.param(False, id="without_hassio"),
),
],
)
async def test_info(
hass: HomeAssistant,
@ -54,10 +54,10 @@ async def test_info(
@pytest.mark.parametrize(
"with_hassio",
(
[
pytest.param(True, id="with_hassio"),
pytest.param(False, id="without_hassio"),
),
],
)
async def test_remove(
hass: HomeAssistant,
@ -80,10 +80,10 @@ async def test_remove(
@pytest.mark.parametrize(
"with_hassio",
(
[
pytest.param(True, id="with_hassio"),
pytest.param(False, id="without_hassio"),
),
],
)
async def test_generate(
hass: HomeAssistant,
@ -111,10 +111,10 @@ async def test_generate(
)
@pytest.mark.parametrize(
("with_hassio"),
(
[
pytest.param(True, id="with_hassio"),
pytest.param(False, id="without_hassio"),
),
],
)
async def test_backup_end(
hass: HomeAssistant,
@ -145,10 +145,10 @@ async def test_backup_end(
)
@pytest.mark.parametrize(
("with_hassio"),
(
[
pytest.param(True, id="with_hassio"),
pytest.param(False, id="without_hassio"),
),
],
)
async def test_backup_start(
hass: HomeAssistant,
@ -174,11 +174,11 @@ async def test_backup_start(
@pytest.mark.parametrize(
"exception",
(
[
TimeoutError(),
HomeAssistantError("Boom"),
Exception("Boom"),
),
],
)
async def test_backup_end_excepion(
hass: HomeAssistant,
@ -203,11 +203,11 @@ async def test_backup_end_excepion(
@pytest.mark.parametrize(
"exception",
(
[
TimeoutError(),
HomeAssistantError("Boom"),
Exception("Boom"),
),
],
)
async def test_backup_start_excepion(
hass: HomeAssistant,

View file

@ -82,12 +82,12 @@ async def test_get_conditions(
@pytest.mark.parametrize(
("hidden_by", "entity_category"),
(
[
(er.RegistryEntryHider.INTEGRATION, None),
(er.RegistryEntryHider.USER, None),
(None, EntityCategory.CONFIG),
(None, EntityCategory.DIAGNOSTIC),
),
],
)
async def test_get_conditions_hidden_auxiliary(
hass: HomeAssistant,

View file

@ -82,12 +82,12 @@ async def test_get_triggers(
@pytest.mark.parametrize(
("hidden_by", "entity_category"),
(
[
(er.RegistryEntryHider.INTEGRATION, None),
(er.RegistryEntryHider.USER, None),
(None, EntityCategory.CONFIG),
(None, EntityCategory.DIAGNOSTIC),
),
],
)
async def test_get_triggers_hidden_auxiliary(
hass: HomeAssistant,

View file

@ -119,10 +119,10 @@ async def test_fetch_blueprint_from_community_url(
@pytest.mark.parametrize(
"url",
(
[
"https://raw.githubusercontent.com/balloob/home-assistant-config/main/blueprints/automation/motion_light.yaml",
"https://github.com/balloob/home-assistant-config/blob/main/blueprints/automation/motion_light.yaml",
),
],
)
async def test_fetch_blueprint_from_github_url(
hass: HomeAssistant, aioclient_mock: AiohttpClientMocker, url: str

View file

@ -12,7 +12,7 @@ _LOGGER = logging.getLogger(__name__)
@pytest.mark.parametrize(
"blueprint",
(
[
# Test allow extra
{
"trigger": "Test allow extra",
@ -52,7 +52,7 @@ _LOGGER = logging.getLogger(__name__)
},
}
},
),
],
)
def test_blueprint_schema(blueprint) -> None:
"""Test different schemas."""
@ -65,7 +65,7 @@ def test_blueprint_schema(blueprint) -> None:
@pytest.mark.parametrize(
"blueprint",
(
[
# no domain
{"blueprint": {}},
# non existing key in blueprint
@ -94,7 +94,7 @@ def test_blueprint_schema(blueprint) -> None:
},
}
},
),
],
)
def test_blueprint_schema_invalid(blueprint) -> None:
"""Test different schemas."""
@ -104,11 +104,11 @@ def test_blueprint_schema_invalid(blueprint) -> None:
@pytest.mark.parametrize(
"bp_instance",
(
[
{"path": "hello.yaml"},
{"path": "hello.yaml", "input": {}},
{"path": "hello.yaml", "input": {"hello": None}},
),
],
)
def test_blueprint_instance_fields(bp_instance) -> None:
"""Test blueprint instance fields."""

View file

@ -400,7 +400,7 @@ async def test_delete_non_exist_file_blueprint(
@pytest.mark.parametrize(
"automation_config",
(
[
{
"automation": {
"use_blueprint": {
@ -413,7 +413,7 @@ async def test_delete_non_exist_file_blueprint(
}
}
},
),
],
)
async def test_delete_blueprint_in_use_by_automation(
hass: HomeAssistant,
@ -446,7 +446,7 @@ async def test_delete_blueprint_in_use_by_automation(
@pytest.mark.parametrize(
"script_config",
(
[
{
"script": {
"test_script": {
@ -459,7 +459,7 @@ async def test_delete_blueprint_in_use_by_automation(
}
}
},
),
],
)
async def test_delete_blueprint_in_use_by_script(
hass: HomeAssistant,

View file

@ -50,12 +50,12 @@ async def test_get_actions(
@pytest.mark.parametrize(
("hidden_by", "entity_category"),
(
[
(er.RegistryEntryHider.INTEGRATION, None),
(er.RegistryEntryHider.USER, None),
(None, EntityCategory.CONFIG),
(None, EntityCategory.DIAGNOSTIC),
),
],
)
async def test_get_actions_hidden_auxiliary(
hass: HomeAssistant,

View file

@ -59,12 +59,12 @@ async def test_get_triggers(
@pytest.mark.parametrize(
("hidden_by", "entity_category"),
(
[
(er.RegistryEntryHider.INTEGRATION, None),
(er.RegistryEntryHider.USER, None),
(None, EntityCategory.CONFIG),
(None, EntityCategory.DIAGNOSTIC),
),
],
)
async def test_get_triggers_hidden_auxiliary(
hass,

View file

@ -17,7 +17,7 @@ from tests.test_util.aiohttp import AiohttpClientMocker
@pytest.mark.parametrize(
("url", "fixture", "content_type"),
(
[
(
"http://a.files.bbci.co.uk/media/live/manifesto/audio/simulcast/hls/nonuk/sbr_low/ak/bbc_radio_fourfm.m3u8",
"bbc_radio_fourfm.m3u8",
@ -33,7 +33,7 @@ from tests.test_util.aiohttp import AiohttpClientMocker
"rthkaudio2.m3u8",
None,
),
),
],
)
async def test_hls_playlist_supported(
hass: HomeAssistant, aioclient_mock: AiohttpClientMocker, url, fixture, content_type
@ -47,7 +47,7 @@ async def test_hls_playlist_supported(
@pytest.mark.parametrize(
("url", "fixture", "content_type", "expected_playlist"),
(
[
(
"https://sverigesradio.se/topsy/direkt/209-hi-mp3.m3u",
"209-hi-mp3.m3u",
@ -96,7 +96,7 @@ async def test_hls_playlist_supported(
)
],
),
),
],
)
async def test_parse_playlist(
hass: HomeAssistant,
@ -115,7 +115,7 @@ async def test_parse_playlist(
@pytest.mark.parametrize(
("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"),
("http://sverigesradio.se/164-hi-aac.pls", "164-hi-aac_invalid_version.pls"),
@ -126,7 +126,7 @@ async def test_parse_playlist(
("http://sverigesradio.se/164-hi-aac.pls", "164-hi-aac_no_version.pls"),
("https://sverigesradio.se/209-hi-mp3.m3u", "209-hi-mp3_bad_url.m3u"),
("https://sverigesradio.se/209-hi-mp3.m3u", "empty.m3u"),
),
],
)
async def test_parse_bad_playlist(
hass: HomeAssistant, aioclient_mock: AiohttpClientMocker, url, fixture
@ -139,10 +139,10 @@ async def test_parse_bad_playlist(
@pytest.mark.parametrize(
("url", "exc"),
(
[
("http://sverigesradio.se/164-hi-aac.pls", TimeoutError),
("http://sverigesradio.se/164-hi-aac.pls", client_exceptions.ClientError),
),
],
)
async def test_parse_http_error(
hass: HomeAssistant, aioclient_mock: AiohttpClientMocker, url, exc

View file

@ -754,7 +754,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,
@ -1261,7 +1261,7 @@ async def test_entity_play_media_sign_URL(hass: HomeAssistant, quick_play_mock)
@pytest.mark.parametrize(
("url", "fixture", "playlist_item"),
(
[
# Test title is extracted from m3u playlist
(
"https://sverigesradio.se/topsy/direkt/209-hi-mp3.m3u",
@ -1307,7 +1307,7 @@ async def test_entity_play_media_sign_URL(hass: HomeAssistant, quick_play_mock)
"media_type": "audio",
},
),
),
],
)
async def test_entity_play_media_playlist(
hass: HomeAssistant,

View file

@ -97,12 +97,12 @@ async def test_get_actions(
@pytest.mark.parametrize(
("hidden_by", "entity_category"),
(
[
(RegistryEntryHider.INTEGRATION, None),
(RegistryEntryHider.USER, None),
(None, EntityCategory.CONFIG),
(None, EntityCategory.DIAGNOSTIC),
),
],
)
async def test_get_actions_hidden_auxiliary(
hass: HomeAssistant,

View file

@ -101,12 +101,12 @@ async def test_get_conditions(
@pytest.mark.parametrize(
("hidden_by", "entity_category"),
(
[
(RegistryEntryHider.INTEGRATION, None),
(RegistryEntryHider.USER, None),
(None, EntityCategory.CONFIG),
(None, EntityCategory.DIAGNOSTIC),
),
],
)
async def test_get_conditions_hidden_auxiliary(
hass: HomeAssistant,

View file

@ -88,12 +88,12 @@ async def test_get_triggers(
@pytest.mark.parametrize(
("hidden_by", "entity_category"),
(
[
(RegistryEntryHider.INTEGRATION, None),
(RegistryEntryHider.USER, None),
(None, EntityCategory.CONFIG),
(None, EntityCategory.DIAGNOSTIC),
),
],
)
async def test_get_triggers_hidden_auxiliary(
hass: HomeAssistant,

View file

@ -39,7 +39,7 @@ async def test_unload_entry(hass: HomeAssistant, cfupdate) -> None:
@pytest.mark.parametrize(
"side_effect",
(pycfdns.ComunicationException(),),
[pycfdns.ComunicationException()],
)
async def test_async_setup_raises_entry_not_ready(
hass: HomeAssistant, cfupdate, side_effect

View file

@ -35,7 +35,7 @@ async def setup_automation(
)
@pytest.mark.parametrize("automation_config", ({},))
@pytest.mark.parametrize("automation_config", [{}])
async def test_get_automation_config(
hass: HomeAssistant,
hass_client: ClientSessionGenerator,
@ -58,7 +58,7 @@ async def test_get_automation_config(
assert result == {"id": "moon"}
@pytest.mark.parametrize("automation_config", ({},))
@pytest.mark.parametrize("automation_config", [{}])
async def test_update_automation_config(
hass: HomeAssistant,
hass_client: ClientSessionGenerator,
@ -97,7 +97,7 @@ async def test_update_automation_config(
assert new_data[1] == {"id": "moon", "trigger": [], "condition": [], "action": []}
@pytest.mark.parametrize("automation_config", ({},))
@pytest.mark.parametrize("automation_config", [{}])
@pytest.mark.parametrize(
("updated_config", "validation_error"),
[
@ -179,7 +179,7 @@ async def test_update_automation_config_with_error(
assert validation_error not in caplog.text
@pytest.mark.parametrize("automation_config", ({},))
@pytest.mark.parametrize("automation_config", [{}])
@pytest.mark.parametrize(
("updated_config", "validation_error"),
[
@ -236,7 +236,7 @@ async def test_update_automation_config_with_blueprint_substitution_error(
assert validation_error not in caplog.text
@pytest.mark.parametrize("automation_config", ({},))
@pytest.mark.parametrize("automation_config", [{}])
async def test_update_remove_key_automation_config(
hass: HomeAssistant,
hass_client: ClientSessionGenerator,
@ -275,7 +275,7 @@ async def test_update_remove_key_automation_config(
assert new_data[1] == {"id": "moon", "trigger": [], "condition": [], "action": []}
@pytest.mark.parametrize("automation_config", ({},))
@pytest.mark.parametrize("automation_config", [{}])
async def test_bad_formatted_automations(
hass: HomeAssistant,
hass_client: ClientSessionGenerator,
@ -323,7 +323,7 @@ async def test_bad_formatted_automations(
@pytest.mark.parametrize(
"automation_config",
(
[
[
{
"id": "sun",
@ -336,7 +336,7 @@ async def test_bad_formatted_automations(
"action": {"service": "test.automation"},
},
],
),
],
)
async def test_delete_automation(
hass: HomeAssistant,
@ -378,7 +378,7 @@ async def test_delete_automation(
assert len(entity_registry.entities) == 1
@pytest.mark.parametrize("automation_config", ({},))
@pytest.mark.parametrize("automation_config", [{}])
async def test_api_calls_require_admin(
hass: HomeAssistant,
hass_client: ClientSessionGenerator,

View file

@ -329,11 +329,11 @@ async def test_reload_entry_in_setup_retry(
@pytest.mark.parametrize(
("type_filter", "result"),
(
[
(None, {"hello", "another", "world"}),
("integration", {"hello", "another"}),
("helper", {"world"}),
),
],
)
async def test_available_flows(
hass: HomeAssistant, client, type_filter, result

View file

@ -132,13 +132,13 @@ async def test_list_devices(
@pytest.mark.parametrize(
("payload_key", "payload_value"),
[
["area_id", "12345A"],
["area_id", None],
["disabled_by", dr.DeviceEntryDisabler.USER],
["disabled_by", "user"],
["disabled_by", None],
["name_by_user", "Test Friendly Name"],
["name_by_user", None],
("area_id", "12345A"),
("area_id", None),
("disabled_by", dr.DeviceEntryDisabler.USER),
("disabled_by", "user"),
("disabled_by", None),
("name_by_user", "Test Friendly Name"),
("name_by_user", None),
],
)
async def test_update_device(

View file

@ -22,7 +22,7 @@ async def setup_scene(hass, scene_config):
await hass.async_block_till_done()
@pytest.mark.parametrize("scene_config", ({},))
@pytest.mark.parametrize("scene_config", [{}])
async def test_create_scene(
hass: HomeAssistant,
hass_client: ClientSessionGenerator,
@ -69,7 +69,7 @@ async def test_create_scene(
]
@pytest.mark.parametrize("scene_config", ({},))
@pytest.mark.parametrize("scene_config", [{}])
async def test_update_scene(
hass: HomeAssistant,
hass_client: ClientSessionGenerator,
@ -117,7 +117,7 @@ async def test_update_scene(
]
@pytest.mark.parametrize("scene_config", ({},))
@pytest.mark.parametrize("scene_config", [{}])
async def test_bad_formatted_scene(
hass: HomeAssistant,
hass_client: ClientSessionGenerator,
@ -177,12 +177,12 @@ async def test_bad_formatted_scene(
@pytest.mark.parametrize(
"scene_config",
(
[
[
{"id": "light_on", "name": "Light on", "entities": {}},
{"id": "light_off", "name": "Light off", "entities": {}},
],
),
],
)
async def test_delete_scene(
hass: HomeAssistant,
@ -226,7 +226,7 @@ async def test_delete_scene(
assert len(entity_registry.entities) == 1
@pytest.mark.parametrize("scene_config", ({},))
@pytest.mark.parametrize("scene_config", [{}])
async def test_api_calls_require_admin(
hass: HomeAssistant,
hass_client: ClientSessionGenerator,

View file

@ -29,7 +29,7 @@ async def setup_script(hass, script_config, stub_blueprint_populate):
assert await async_setup_component(hass, "script", {"script": script_config})
@pytest.mark.parametrize("script_config", ({},))
@pytest.mark.parametrize("script_config", [{}])
async def test_get_script_config(
hass: HomeAssistant, hass_client: ClientSessionGenerator, hass_config_store
) -> None:
@ -52,7 +52,7 @@ async def test_get_script_config(
assert result == {"alias": "Moon"}
@pytest.mark.parametrize("script_config", ({},))
@pytest.mark.parametrize("script_config", [{}])
async def test_update_script_config(
hass: HomeAssistant, hass_client: ClientSessionGenerator, hass_config_store
) -> None:
@ -88,7 +88,7 @@ async def test_update_script_config(
assert new_data["moon"] == {"alias": "Moon updated", "sequence": []}
@pytest.mark.parametrize("script_config", ({},))
@pytest.mark.parametrize("script_config", [{}])
async def test_invalid_object_id(
hass: HomeAssistant, hass_client: ClientSessionGenerator, hass_config_store
) -> None:
@ -122,7 +122,7 @@ async def test_invalid_object_id(
assert new_data == {}
@pytest.mark.parametrize("script_config", ({},))
@pytest.mark.parametrize("script_config", [{}])
@pytest.mark.parametrize(
("updated_config", "validation_error"),
[
@ -182,7 +182,7 @@ async def test_update_script_config_with_error(
assert validation_error not in caplog.text
@pytest.mark.parametrize("script_config", ({},))
@pytest.mark.parametrize("script_config", [{}])
@pytest.mark.parametrize(
("updated_config", "validation_error"),
[
@ -237,7 +237,7 @@ async def test_update_script_config_with_blueprint_substitution_error(
assert validation_error not in caplog.text
@pytest.mark.parametrize("script_config", ({},))
@pytest.mark.parametrize("script_config", [{}])
async def test_update_remove_key_script_config(
hass: HomeAssistant, hass_client: ClientSessionGenerator, hass_config_store
) -> None:
@ -275,12 +275,12 @@ async def test_update_remove_key_script_config(
@pytest.mark.parametrize(
"script_config",
(
[
{
"one": {"alias": "Light on", "sequence": []},
"two": {"alias": "Light off", "sequence": []},
},
),
],
)
async def test_delete_script(
hass: HomeAssistant,
@ -320,7 +320,7 @@ async def test_delete_script(
assert len(entity_registry.entities) == 1
@pytest.mark.parametrize("script_config", ({},))
@pytest.mark.parametrize("script_config", [{}])
async def test_api_calls_require_admin(
hass: HomeAssistant,
hass_client: ClientSessionGenerator,

View file

@ -502,8 +502,8 @@ async def test_http_processing_intent_conversion_not_expose_new(
@pytest.mark.parametrize("agent_id", AGENT_ID_OPTIONS)
@pytest.mark.parametrize("sentence", ("turn on kitchen", "turn kitchen on"))
@pytest.mark.parametrize("conversation_id", ("my_new_conversation", None))
@pytest.mark.parametrize("sentence", ["turn on kitchen", "turn kitchen on"])
@pytest.mark.parametrize("conversation_id", ["my_new_conversation", None])
async def test_turn_on_intent(
hass: HomeAssistant, init_components, conversation_id, sentence, agent_id, snapshot
) -> None:
@ -550,7 +550,7 @@ async def test_service_fails(hass: HomeAssistant, init_components) -> None:
)
@pytest.mark.parametrize("sentence", ("turn off kitchen", "turn kitchen off"))
@pytest.mark.parametrize("sentence", ["turn off kitchen", "turn kitchen off"])
async def test_turn_off_intent(hass: HomeAssistant, init_components, sentence) -> None:
"""Test calling the turn on intent."""
hass.states.async_set("light.kitchen", "on")

View file

@ -94,12 +94,12 @@ async def test_get_actions(
@pytest.mark.parametrize(
("hidden_by", "entity_category"),
(
[
(RegistryEntryHider.INTEGRATION, None),
(RegistryEntryHider.USER, None),
(None, EntityCategory.CONFIG),
(None, EntityCategory.DIAGNOSTIC),
),
],
)
async def test_get_actions_hidden_auxiliary(
hass: HomeAssistant,

View file

@ -123,12 +123,12 @@ async def test_get_conditions(
@pytest.mark.parametrize(
("hidden_by", "entity_category"),
(
[
(RegistryEntryHider.INTEGRATION, None),
(RegistryEntryHider.USER, None),
(None, EntityCategory.CONFIG),
(None, EntityCategory.DIAGNOSTIC),
),
],
)
async def test_get_conditions_hidden_auxiliary(
hass: HomeAssistant,

View file

@ -124,12 +124,12 @@ async def test_get_triggers(
@pytest.mark.parametrize(
("hidden_by", "entity_category"),
(
[
(RegistryEntryHider.INTEGRATION, None),
(RegistryEntryHider.USER, None),
(None, EntityCategory.CONFIG),
(None, EntityCategory.DIAGNOSTIC),
),
],
)
async def test_get_triggers_hidden_auxiliary(
hass: HomeAssistant,

View file

@ -26,7 +26,7 @@ async def sensor_only() -> None:
yield
@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: FrozenDateTimeFactory
) -> None:
@ -47,7 +47,7 @@ async def test_energy_sensor(
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: FrozenDateTimeFactory
) -> None:

View file

@ -12,7 +12,7 @@ from homeassistant.data_entry_flow import FlowResultType
from tests.common import MockConfigEntry
@pytest.mark.parametrize("platform", ("sensor",))
@pytest.mark.parametrize("platform", ["sensor"])
async def test_config_flow(hass: HomeAssistant, platform) -> None:
"""Test the config flow."""
input_sensor_entity_id = "sensor.input"
@ -74,7 +74,7 @@ def get_suggested(schema, key):
raise Exception
@pytest.mark.parametrize("platform", ("sensor",))
@pytest.mark.parametrize("platform", ["sensor"])
async def test_options(hass: HomeAssistant, platform) -> None:
"""Test reconfiguring."""
# Setup the config entry

View file

@ -9,7 +9,7 @@ from homeassistant.helpers import entity_registry as er
from tests.common import MockConfigEntry
@pytest.mark.parametrize("platform", ("sensor",))
@pytest.mark.parametrize("platform", ["sensor"])
async def test_setup_and_remove_config_entry(
hass: HomeAssistant,
entity_registry: er.EntityRegistry,

View file

@ -64,12 +64,12 @@ async def test_get_conditions(
@pytest.mark.parametrize(
("hidden_by", "entity_category"),
(
[
(RegistryEntryHider.INTEGRATION, None),
(RegistryEntryHider.USER, None),
(None, EntityCategory.CONFIG),
(None, EntityCategory.DIAGNOSTIC),
),
],
)
async def test_get_conditions_hidden_auxiliary(
hass: HomeAssistant,

View file

@ -96,12 +96,12 @@ async def test_get_triggers(
@pytest.mark.parametrize(
("hidden_by", "entity_category"),
(
[
(RegistryEntryHider.INTEGRATION, None),
(RegistryEntryHider.USER, None),
(None, EntityCategory.CONFIG),
(None, EntityCategory.DIAGNOSTIC),
),
],
)
async def test_get_triggers_hidden_auxiliary(
hass: HomeAssistant,

View file

@ -40,26 +40,26 @@ async def test_button_setup(hass: HomeAssistant) -> None:
@pytest.mark.parametrize(
("name", "api_name", "trigger_method"),
[
[
(
"identify_device_with_a_blinking_led",
"plcnet",
"async_identify_device_start",
],
[
),
(
"start_plc_pairing",
"plcnet",
"async_pair_device",
],
[
),
(
"restart_device",
"device",
"async_restart",
],
[
),
(
"start_wps",
"device",
"async_start_wps",
],
),
],
)
@pytest.mark.freeze_time("2023-01-13 12:00:00+00:00")

View file

@ -64,7 +64,7 @@ async def test_form(hass: HomeAssistant, info: dict[str, Any]) -> None:
@pytest.mark.parametrize(
("exception_type", "expected_error"),
[[DeviceNotFound(IP), "cannot_connect"], [Exception, "unknown"]],
[(DeviceNotFound(IP), "cannot_connect"), (Exception, "unknown")],
)
async def test_form_error(hass: HomeAssistant, exception_type, expected_error) -> None:
"""Test we handle errors."""

View file

@ -95,15 +95,15 @@ async def test_hass_stop(hass: HomeAssistant, mock_device: MockDevice) -> None:
@pytest.mark.parametrize(
("device", "expected_platforms"),
[
[
(
"mock_device",
(BINARY_SENSOR, BUTTON, DEVICE_TRACKER, IMAGE, SENSOR, SWITCH, UPDATE),
],
[
),
(
"mock_repeater_device",
(BUTTON, DEVICE_TRACKER, IMAGE, SENSOR, SWITCH, UPDATE),
],
["mock_nonwifi_device", (BINARY_SENSOR, BUTTON, SENSOR, SWITCH, UPDATE)],
),
("mock_nonwifi_device", (BINARY_SENSOR, BUTTON, SENSOR, SWITCH, UPDATE)),
],
)
async def test_platforms(

View file

@ -66,21 +66,21 @@ async def test_sensor_setup(hass: HomeAssistant) -> None:
@pytest.mark.parametrize(
("name", "get_method", "interval"),
[
[
(
"connected_wifi_clients",
"async_get_wifi_connected_station",
SHORT_UPDATE_INTERVAL,
],
[
),
(
"neighboring_wifi_networks",
"async_get_wifi_neighbor_access_points",
LONG_UPDATE_INTERVAL,
],
[
),
(
"connected_plc_devices",
"async_get_network_overview",
LONG_UPDATE_INTERVAL,
],
),
],
)
@pytest.mark.usefixtures("entity_registry_enabled_by_default")

View file

@ -247,8 +247,8 @@ async def test_update_enable_leds(
@pytest.mark.parametrize(
("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],
("enable_guest_wifi", "async_get_wifi_guest_access", SHORT_UPDATE_INTERVAL),
("enable_leds", "async_get_led_setting", SHORT_UPDATE_INTERVAL),
],
)
async def test_device_failure(
@ -284,8 +284,8 @@ async def test_device_failure(
@pytest.mark.parametrize(
("name", "set_method"),
[
["enable_guest_wifi", "async_set_wifi_guest_access"],
["enable_leds", "async_set_led_setting"],
("enable_guest_wifi", "async_set_wifi_guest_access"),
("enable_leds", "async_set_led_setting"),
],
)
async def test_auth_failed(

View file

@ -272,7 +272,7 @@ async def test_setup_entry_no_options(
@pytest.mark.parametrize(
"core_state",
(CoreState.not_running, CoreState.running),
[CoreState.not_running, CoreState.running],
)
async def test_setup_entry_with_options(
hass: HomeAssistant,
@ -1261,7 +1261,7 @@ async def test_playback_update_state(
@pytest.mark.parametrize(
"core_state",
(CoreState.not_running, CoreState.running),
[CoreState.not_running, CoreState.running],
)
async def test_unavailable_device(
hass: HomeAssistant,
@ -1388,7 +1388,7 @@ async def test_unavailable_device(
@pytest.mark.parametrize(
"core_state",
(CoreState.not_running, CoreState.running),
[CoreState.not_running, CoreState.running],
)
async def test_become_available(
hass: HomeAssistant,
@ -1479,7 +1479,7 @@ async def test_become_available(
@pytest.mark.parametrize(
"core_state",
(CoreState.not_running, CoreState.running),
[CoreState.not_running, CoreState.running],
)
async def test_alive_but_gone(
hass: HomeAssistant,
@ -2329,7 +2329,7 @@ async def test_config_update_mac_address(
@pytest.mark.parametrize(
"core_state",
(CoreState.not_running, CoreState.running),
[CoreState.not_running, CoreState.running],
)
async def test_connections_restored(
hass: HomeAssistant,

View file

@ -222,10 +222,10 @@ async def test_bluetooth_step_already_in_progress(hass: HomeAssistant) -> None:
@pytest.mark.parametrize(
("exc", "error"),
(
[
(BleakError, "cannot_connect"),
(Exception, "unknown"),
),
],
)
async def test_bluetooth_step_cannot_connect(hass: HomeAssistant, exc, error) -> None:
"""Test bluetooth step and we cannot connect."""
@ -261,10 +261,10 @@ async def test_bluetooth_step_cannot_connect(hass: HomeAssistant, exc, error) ->
@pytest.mark.parametrize(
("exc", "error"),
(
[
(dkey_errors.InvalidActivationCode, "invalid_code"),
(dkey_errors.WrongActivationCode, "wrong_code"),
),
],
)
async def test_bluetooth_step_cannot_associate(hass: HomeAssistant, exc, error) -> None:
"""Test bluetooth step and we cannot associate."""

View file

@ -16,11 +16,11 @@ from tests.common import MockConfigEntry
@pytest.mark.parametrize(
("button", "function"),
(
[
("cancel", "stop"),
("pause", "pause"),
("resume", "resume"),
),
],
)
async def test_buttons(
hass: HomeAssistant,

View file

@ -198,12 +198,12 @@ async def test_abort_when_metering_point_id_exist(
@pytest.mark.parametrize(
("side_effect", "base_error"),
(
[
(ElviaError.ElviaException("Boom"), "unknown"),
(ElviaError.AuthError("Boom", 403, {}, ""), "invalid_auth"),
(ElviaError.ElviaServerException("Boom", 500, {}, ""), "unknown"),
(ElviaError.ElviaClientException("Boom"), "unknown"),
),
],
)
async def test_form_exceptions(
recorder_mock: Recorder,

View file

@ -988,7 +988,7 @@ async def test_cost_sensor_handle_late_price_sensor(
@pytest.mark.parametrize(
"unit",
(UnitOfVolume.CUBIC_FEET, UnitOfVolume.CUBIC_METERS),
[UnitOfVolume.CUBIC_FEET, UnitOfVolume.CUBIC_METERS],
)
async def test_cost_sensor_handle_gas(
setup_integration, hass: HomeAssistant, hass_storage: dict[str, Any], unit
@ -1086,12 +1086,12 @@ async def test_cost_sensor_handle_gas_kwh(
@pytest.mark.parametrize(
("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),
(US_CUSTOMARY_SYSTEM, UnitOfVolume.GALLONS, 50.0),
(METRIC_SYSTEM, UnitOfVolume.CUBIC_METERS, 50.0),
),
],
)
async def test_cost_sensor_handle_water(
setup_integration,

View file

@ -690,7 +690,7 @@ async def test_validation_grid_auto_cost_entity_errors(
@pytest.mark.parametrize(
("state", "unit", "expected"),
(
[
(
"123,123.12",
"$/kWh",
@ -711,7 +711,7 @@ async def test_validation_grid_auto_cost_entity_errors(
},
},
),
),
],
)
async def test_validation_grid_price_errors(
hass: HomeAssistant, mock_energy_manager, mock_get_metadata, state, unit, expected

View file

@ -45,7 +45,7 @@ async def test_assist_in_progress(
@pytest.mark.parametrize(
"binary_state", ((True, STATE_ON), (False, STATE_OFF), (None, STATE_UNKNOWN))
"binary_state", [(True, STATE_ON), (False, STATE_OFF), (None, STATE_UNKNOWN)]
)
async def test_binary_sensor_generic_entity(
hass: HomeAssistant,

View file

@ -58,12 +58,12 @@ async def test_get_actions(
@pytest.mark.parametrize(
("hidden_by", "entity_category"),
(
[
(RegistryEntryHider.INTEGRATION, None),
(RegistryEntryHider.USER, None),
(None, EntityCategory.CONFIG),
(None, EntityCategory.DIAGNOSTIC),
),
],
)
async def test_get_actions_hidden_auxiliary(
hass: HomeAssistant,

View file

@ -64,12 +64,12 @@ async def test_get_conditions(
@pytest.mark.parametrize(
("hidden_by", "entity_category"),
(
[
(RegistryEntryHider.INTEGRATION, None),
(RegistryEntryHider.USER, None),
(None, EntityCategory.CONFIG),
(None, EntityCategory.DIAGNOSTIC),
),
],
)
async def test_get_conditions_hidden_auxiliary(
hass: HomeAssistant,

View file

@ -69,12 +69,12 @@ async def test_get_triggers(
@pytest.mark.parametrize(
("hidden_by", "entity_category"),
(
[
(RegistryEntryHider.INTEGRATION, None),
(RegistryEntryHider.USER, None),
(None, EntityCategory.CONFIG),
(None, EntityCategory.DIAGNOSTIC),
),
],
)
async def test_get_triggers_hidden_auxiliary(
hass: HomeAssistant,

View file

@ -92,7 +92,7 @@ async def test_chain(
assert state.state == "18.05"
@pytest.mark.parametrize("missing", (True, False))
@pytest.mark.parametrize("missing", [True, False])
async def test_chain_history(
recorder_mock: Recorder,
hass: HomeAssistant,

View file

@ -167,11 +167,11 @@ async def test_sensors(
@pytest.mark.parametrize(
"entity_id",
(
[
"sensor.power_production_next_12hours",
"sensor.power_production_next_24hours",
"sensor.power_production_next_hour",
),
],
)
async def test_disabled_by_default(
hass: HomeAssistant,

View file

@ -404,7 +404,7 @@ async def test_config_local_sdk_allow_min_version(
) not in caplog.text
@pytest.mark.parametrize("version", (None, "2.1.4"))
@pytest.mark.parametrize("version", [None, "2.1.4"])
async def test_config_local_sdk_warn_version(
hass: HomeAssistant,
hass_client: ClientSessionGenerator,

View file

@ -3306,11 +3306,11 @@ async def test_openclose_cover_valve_no_position(
@pytest.mark.parametrize(
"device_class",
(
[
cover.CoverDeviceClass.DOOR,
cover.CoverDeviceClass.GARAGE,
cover.CoverDeviceClass.GATE,
),
],
)
async def test_openclose_cover_secure(hass: HomeAssistant, device_class) -> None:
"""Test OpenClose trait support for cover domain."""
@ -3372,13 +3372,13 @@ async def test_openclose_cover_secure(hass: HomeAssistant, device_class) -> None
@pytest.mark.parametrize(
"device_class",
(
[
binary_sensor.BinarySensorDeviceClass.DOOR,
binary_sensor.BinarySensorDeviceClass.GARAGE_DOOR,
binary_sensor.BinarySensorDeviceClass.LOCK,
binary_sensor.BinarySensorDeviceClass.OPENING,
binary_sensor.BinarySensorDeviceClass.WINDOW,
),
],
)
async def test_openclose_binary_sensor(hass: HomeAssistant, device_class) -> None:
"""Test OpenClose trait support for binary_sensor domain."""
@ -3816,7 +3816,7 @@ async def test_transport_control(
@pytest.mark.parametrize(
"state",
(
[
STATE_OFF,
STATE_IDLE,
STATE_PLAYING,
@ -3825,7 +3825,7 @@ async def test_transport_control(
STATE_STANDBY,
STATE_UNAVAILABLE,
STATE_UNKNOWN,
),
],
)
async def test_media_state(hass: HomeAssistant, state) -> None:
"""Test the MediaStateTrait."""

View file

@ -62,10 +62,10 @@ async def test_set_vacation(
@pytest.mark.parametrize(
("side_effect"),
(
[
(RefreshError,),
(ClientResponseError("", (), status=400),),
),
],
)
async def test_reauth_trigger(
hass: HomeAssistant,

View file

@ -514,7 +514,7 @@ async def test_update_target_temperature(
@pytest.mark.parametrize(
"preset", (PRESET_AWAY, PRESET_ECO, PRESET_SLEEP, PRESET_BOOST, PRESET_NONE)
"preset", [PRESET_AWAY, PRESET_ECO, PRESET_SLEEP, PRESET_BOOST, PRESET_NONE]
)
async def test_send_preset_mode(
hass: HomeAssistant, discovery, device, mock_now, preset
@ -554,7 +554,7 @@ async def test_send_invalid_preset_mode(
@pytest.mark.parametrize(
"preset", (PRESET_AWAY, PRESET_ECO, PRESET_SLEEP, PRESET_BOOST, PRESET_NONE)
"preset", [PRESET_AWAY, PRESET_ECO, PRESET_SLEEP, PRESET_BOOST, PRESET_NONE]
)
async def test_send_preset_mode_device_timeout(
hass: HomeAssistant, discovery, device, mock_now, preset
@ -577,7 +577,7 @@ async def test_send_preset_mode_device_timeout(
@pytest.mark.parametrize(
"preset", (PRESET_AWAY, PRESET_ECO, PRESET_SLEEP, PRESET_BOOST, PRESET_NONE)
"preset", [PRESET_AWAY, PRESET_ECO, PRESET_SLEEP, PRESET_BOOST, PRESET_NONE]
)
async def test_update_preset_mode(
hass: HomeAssistant, discovery, device, mock_now, preset
@ -597,14 +597,14 @@ async def test_update_preset_mode(
@pytest.mark.parametrize(
"hvac_mode",
(
[
HVACMode.OFF,
HVACMode.AUTO,
HVACMode.COOL,
HVACMode.DRY,
HVACMode.FAN_ONLY,
HVACMode.HEAT,
),
],
)
async def test_send_hvac_mode(
hass: HomeAssistant, discovery, device, mock_now, hvac_mode
@ -626,7 +626,7 @@ async def test_send_hvac_mode(
@pytest.mark.parametrize(
"hvac_mode",
(HVACMode.AUTO, HVACMode.COOL, HVACMode.DRY, HVACMode.FAN_ONLY, HVACMode.HEAT),
[HVACMode.AUTO, HVACMode.COOL, HVACMode.DRY, HVACMode.FAN_ONLY, HVACMode.HEAT],
)
async def test_send_hvac_mode_device_timeout(
hass: HomeAssistant, discovery, device, mock_now, hvac_mode
@ -650,14 +650,14 @@ async def test_send_hvac_mode_device_timeout(
@pytest.mark.parametrize(
"hvac_mode",
(
[
HVACMode.OFF,
HVACMode.AUTO,
HVACMode.COOL,
HVACMode.DRY,
HVACMode.FAN_ONLY,
HVACMode.HEAT,
),
],
)
async def test_update_hvac_mode(
hass: HomeAssistant, discovery, device, mock_now, hvac_mode
@ -675,7 +675,7 @@ async def test_update_hvac_mode(
@pytest.mark.parametrize(
"fan_mode",
(FAN_AUTO, FAN_LOW, FAN_MEDIUM_LOW, FAN_MEDIUM, FAN_MEDIUM_HIGH, FAN_HIGH),
[FAN_AUTO, FAN_LOW, FAN_MEDIUM_LOW, FAN_MEDIUM, FAN_MEDIUM_HIGH, FAN_HIGH],
)
async def test_send_fan_mode(
hass: HomeAssistant, discovery, device, mock_now, fan_mode
@ -716,7 +716,7 @@ async def test_send_invalid_fan_mode(
@pytest.mark.parametrize(
"fan_mode",
(FAN_AUTO, FAN_LOW, FAN_MEDIUM_LOW, FAN_MEDIUM, FAN_MEDIUM_HIGH, FAN_HIGH),
[FAN_AUTO, FAN_LOW, FAN_MEDIUM_LOW, FAN_MEDIUM, FAN_MEDIUM_HIGH, FAN_HIGH],
)
async def test_send_fan_mode_device_timeout(
hass: HomeAssistant, discovery, device, mock_now, fan_mode
@ -740,7 +740,7 @@ async def test_send_fan_mode_device_timeout(
@pytest.mark.parametrize(
"fan_mode",
(FAN_AUTO, FAN_LOW, FAN_MEDIUM_LOW, FAN_MEDIUM, FAN_MEDIUM_HIGH, FAN_HIGH),
[FAN_AUTO, FAN_LOW, FAN_MEDIUM_LOW, FAN_MEDIUM, FAN_MEDIUM_HIGH, FAN_HIGH],
)
async def test_update_fan_mode(
hass: HomeAssistant, discovery, device, mock_now, fan_mode
@ -756,7 +756,7 @@ async def test_update_fan_mode(
@pytest.mark.parametrize(
"swing_mode", (SWING_OFF, SWING_BOTH, SWING_VERTICAL, SWING_HORIZONTAL)
"swing_mode", [SWING_OFF, SWING_BOTH, SWING_VERTICAL, SWING_HORIZONTAL]
)
async def test_send_swing_mode(
hass: HomeAssistant, discovery, device, mock_now, swing_mode
@ -796,7 +796,7 @@ async def test_send_invalid_swing_mode(
@pytest.mark.parametrize(
"swing_mode", (SWING_OFF, SWING_BOTH, SWING_VERTICAL, SWING_HORIZONTAL)
"swing_mode", [SWING_OFF, SWING_BOTH, SWING_VERTICAL, SWING_HORIZONTAL]
)
async def test_send_swing_mode_device_timeout(
hass: HomeAssistant, discovery, device, mock_now, swing_mode
@ -819,7 +819,7 @@ async def test_send_swing_mode_device_timeout(
@pytest.mark.parametrize(
"swing_mode", (SWING_OFF, SWING_BOTH, SWING_VERTICAL, SWING_HORIZONTAL)
"swing_mode", [SWING_OFF, SWING_BOTH, SWING_VERTICAL, SWING_HORIZONTAL]
)
async def test_update_swing_mode(
hass: HomeAssistant, discovery, device, mock_now, swing_mode

View file

@ -26,7 +26,7 @@ from tests.typing import WebSocketGenerator
"extra_options",
"extra_attrs",
),
(
[
("binary_sensor", "on", "on", {}, {}, {"all": False}, {}),
("binary_sensor", "on", "on", {}, {"all": True}, {"all": True}, {}),
("cover", "open", "open", {}, {}, {}, {}),
@ -56,7 +56,7 @@ from tests.typing import WebSocketGenerator
{},
),
("switch", "on", "on", {}, {}, {}, {}),
),
],
)
async def test_config_flow(
hass: HomeAssistant,
@ -129,11 +129,11 @@ async def test_config_flow(
@pytest.mark.parametrize(
("hide_members", "hidden_by"), ((False, None), (True, "integration"))
("hide_members", "hidden_by"), [(False, None), (True, "integration")]
)
@pytest.mark.parametrize(
("group_type", "extra_input"),
(
[
("binary_sensor", {"all": False}),
("cover", {}),
("event", {}),
@ -142,7 +142,7 @@ async def test_config_flow(
("lock", {}),
("media_player", {}),
("switch", {}),
),
],
)
async def test_config_flow_hides_members(
hass: HomeAssistant,
@ -210,7 +210,7 @@ def get_suggested(schema, key):
@pytest.mark.parametrize(
("group_type", "member_state", "extra_options", "options_options"),
(
[
("binary_sensor", "on", {"all": False}, {}),
("cover", "open", {}, {}),
("event", "2021-01-01T23:59:59.123+00:00", {}, {}),
@ -225,7 +225,7 @@ def get_suggested(schema, key):
{"ignore_non_numeric": False, "type": "sum"},
),
("switch", "on", {"all": False}, {}),
),
],
)
async def test_options(
hass: HomeAssistant, group_type, member_state, extra_options, options_options
@ -316,7 +316,7 @@ async def test_options(
@pytest.mark.parametrize(
("group_type", "extra_options", "extra_options_after", "advanced"),
(
[
("light", {"all": False}, {"all": False}, False),
("light", {"all": True}, {"all": True}, False),
("light", {"all": False}, {"all": False}, True),
@ -325,7 +325,7 @@ async def test_options(
("switch", {"all": True}, {"all": True}, False),
("switch", {"all": False}, {"all": False}, True),
("switch", {"all": True}, {"all": False}, True),
),
],
)
async def test_all_options(
hass: HomeAssistant, group_type, extra_options, extra_options_after, advanced
@ -387,14 +387,14 @@ async def test_all_options(
@pytest.mark.parametrize(
("hide_members", "hidden_by_initial", "hidden_by"),
(
[
(False, er.RegistryEntryHider.INTEGRATION, None),
(True, None, er.RegistryEntryHider.INTEGRATION),
),
],
)
@pytest.mark.parametrize(
("group_type", "extra_input"),
(
[
("binary_sensor", {"all": False}),
("cover", {}),
("event", {}),
@ -403,7 +403,7 @@ async def test_all_options(
("lock", {}),
("media_player", {}),
("switch", {}),
),
],
)
async def test_options_flow_hides_members(
hass: HomeAssistant,

View file

@ -1626,7 +1626,7 @@ async def test_plant_group(hass: HomeAssistant) -> None:
@pytest.mark.parametrize(
("group_type", "member_state", "extra_options"),
(
[
("binary_sensor", "on", {"all": False}),
("cover", "open", {}),
("fan", "on", {}),
@ -1642,7 +1642,7 @@ async def test_plant_group(hass: HomeAssistant) -> None:
"state_class": "measurement",
},
),
),
],
)
async def test_setup_and_remove_config_entry(
hass: HomeAssistant,
@ -1689,24 +1689,24 @@ async def test_setup_and_remove_config_entry(
@pytest.mark.parametrize(
("hide_members", "hidden_by_initial", "hidden_by"),
(
[
(False, er.RegistryEntryHider.INTEGRATION, er.RegistryEntryHider.INTEGRATION),
(False, None, None),
(False, er.RegistryEntryHider.USER, er.RegistryEntryHider.USER),
(True, er.RegistryEntryHider.INTEGRATION, None),
(True, None, None),
(True, er.RegistryEntryHider.USER, er.RegistryEntryHider.USER),
),
],
)
@pytest.mark.parametrize(
("group_type", "extra_options"),
(
[
("binary_sensor", {"all": False}),
("cover", {}),
("fan", {}),
("light", {"all": False}),
("media_player", {}),
),
],
)
async def test_unhide_members_on_remove(
hass: HomeAssistant,

View file

@ -315,9 +315,9 @@ async def test_api_ingress_panels(
@pytest.mark.parametrize(
("api_call", "method", "payload"),
[
["retrieve_discovery_messages", "GET", None],
["refresh_updates", "POST", None],
["update_diagnostics", "POST", True],
("retrieve_discovery_messages", "GET", None),
("refresh_updates", "POST", None),
("update_diagnostics", "POST", True),
],
)
async def test_api_headers(

View file

@ -116,7 +116,7 @@ async def origin_step_result_fixture(
@pytest.mark.parametrize(
"menu_options",
(["origin_coordinates", "origin_entity"],),
[["origin_coordinates", "origin_entity"]],
)
@pytest.mark.usefixtures("valid_response")
async def test_step_user(hass: HomeAssistant, menu_options) -> None:

View file

@ -1332,7 +1332,7 @@ async def test_history_stream_live_with_future_end_time(
) == listeners_without_writes(init_listeners)
@pytest.mark.parametrize("include_start_time_state", (True, False))
@pytest.mark.parametrize("include_start_time_state", [True, False])
async def test_history_stream_before_history_starts(
recorder_mock: Recorder,
hass: HomeAssistant,

View file

@ -60,7 +60,7 @@ async def setup_comp(hass):
@pytest.mark.parametrize(
"below", (10, "input_number.value_10", "number.value_10", "sensor.value_10")
"below", [10, "input_number.value_10", "number.value_10", "sensor.value_10"]
)
async def test_if_not_fires_on_entity_removal(
hass: HomeAssistant, calls, below
@ -90,7 +90,7 @@ async def test_if_not_fires_on_entity_removal(
@pytest.mark.parametrize(
"below", (10, "input_number.value_10", "number.value_10", "sensor.value_10")
"below", [10, "input_number.value_10", "number.value_10", "sensor.value_10"]
)
async def test_if_fires_on_entity_change_below(
hass: HomeAssistant, calls, below
@ -139,7 +139,7 @@ async def test_if_fires_on_entity_change_below(
@pytest.mark.parametrize(
"below", (10, "input_number.value_10", "number.value_10", "sensor.value_10")
"below", [10, "input_number.value_10", "number.value_10", "sensor.value_10"]
)
async def test_if_fires_on_entity_change_below_uuid(
hass: HomeAssistant, entity_registry: er.EntityRegistry, calls, below
@ -193,7 +193,7 @@ async def test_if_fires_on_entity_change_below_uuid(
@pytest.mark.parametrize(
"below", (10, "input_number.value_10", "number.value_10", "sensor.value_10")
"below", [10, "input_number.value_10", "number.value_10", "sensor.value_10"]
)
async def test_if_fires_on_entity_change_over_to_below(
hass: HomeAssistant, calls, below
@ -224,7 +224,7 @@ async def test_if_fires_on_entity_change_over_to_below(
@pytest.mark.parametrize(
"below", (10, "input_number.value_10", "number.value_10", "sensor.value_10")
"below", [10, "input_number.value_10", "number.value_10", "sensor.value_10"]
)
async def test_if_fires_on_entities_change_over_to_below(
hass: HomeAssistant, calls, below
@ -259,7 +259,7 @@ async def test_if_fires_on_entities_change_over_to_below(
@pytest.mark.parametrize(
"below", (10, "input_number.value_10", "number.value_10", "sensor.value_10")
"below", [10, "input_number.value_10", "number.value_10", "sensor.value_10"]
)
async def test_if_not_fires_on_entity_change_below_to_below(
hass: HomeAssistant, calls, below
@ -302,7 +302,7 @@ async def test_if_not_fires_on_entity_change_below_to_below(
@pytest.mark.parametrize(
"below", (10, "input_number.value_10", "number.value_10", "sensor.value_10")
"below", [10, "input_number.value_10", "number.value_10", "sensor.value_10"]
)
async def test_if_not_below_fires_on_entity_change_to_equal(
hass: HomeAssistant, calls, below
@ -333,7 +333,7 @@ async def test_if_not_below_fires_on_entity_change_to_equal(
@pytest.mark.parametrize(
"below", (10, "input_number.value_10", "number.value_10", "sensor.value_10")
"below", [10, "input_number.value_10", "number.value_10", "sensor.value_10"]
)
async def test_if_not_fires_on_initial_entity_below(
hass: HomeAssistant, calls, below
@ -364,7 +364,7 @@ async def test_if_not_fires_on_initial_entity_below(
@pytest.mark.parametrize(
"above", (10, "input_number.value_10", "number.value_10", "sensor.value_10")
"above", [10, "input_number.value_10", "number.value_10", "sensor.value_10"]
)
async def test_if_not_fires_on_initial_entity_above(
hass: HomeAssistant, calls, above
@ -395,7 +395,7 @@ async def test_if_not_fires_on_initial_entity_above(
@pytest.mark.parametrize(
"above", (10, "input_number.value_10", "number.value_10", "sensor.value_10")
"above", [10, "input_number.value_10", "number.value_10", "sensor.value_10"]
)
async def test_if_fires_on_entity_change_above(
hass: HomeAssistant, calls, above
@ -448,7 +448,7 @@ async def test_if_fires_on_entity_unavailable_at_startup(
assert len(calls) == 0
@pytest.mark.parametrize("above", (10, "input_number.value_10"))
@pytest.mark.parametrize("above", [10, "input_number.value_10"])
async def test_if_fires_on_entity_change_below_to_above(
hass: HomeAssistant, calls, above
) -> None:
@ -478,7 +478,7 @@ async def test_if_fires_on_entity_change_below_to_above(
assert len(calls) == 1
@pytest.mark.parametrize("above", (10, "input_number.value_10"))
@pytest.mark.parametrize("above", [10, "input_number.value_10"])
async def test_if_not_fires_on_entity_change_above_to_above(
hass: HomeAssistant, calls, above
) -> None:
@ -513,7 +513,7 @@ async def test_if_not_fires_on_entity_change_above_to_above(
assert len(calls) == 1
@pytest.mark.parametrize("above", (10, "input_number.value_10"))
@pytest.mark.parametrize("above", [10, "input_number.value_10"])
async def test_if_not_above_fires_on_entity_change_to_equal(
hass: HomeAssistant, calls, above
) -> None:
@ -545,12 +545,12 @@ async def test_if_not_above_fires_on_entity_change_to_equal(
@pytest.mark.parametrize(
("above", "below"),
(
[
(5, 10),
(5, "input_number.value_10"),
("input_number.value_5", 10),
("input_number.value_5", "input_number.value_10"),
),
],
)
async def test_if_fires_on_entity_change_below_range(
hass: HomeAssistant, calls, above, below
@ -582,12 +582,12 @@ async def test_if_fires_on_entity_change_below_range(
@pytest.mark.parametrize(
("above", "below"),
(
[
(5, 10),
(5, "input_number.value_10"),
("input_number.value_5", 10),
("input_number.value_5", "input_number.value_10"),
),
],
)
async def test_if_fires_on_entity_change_below_above_range(
hass: HomeAssistant, calls, above, below
@ -616,12 +616,12 @@ async def test_if_fires_on_entity_change_below_above_range(
@pytest.mark.parametrize(
("above", "below"),
(
[
(5, 10),
(5, "input_number.value_10"),
("input_number.value_5", 10),
("input_number.value_5", "input_number.value_10"),
),
],
)
async def test_if_fires_on_entity_change_over_to_below_range(
hass: HomeAssistant, calls, above, below
@ -654,12 +654,12 @@ async def test_if_fires_on_entity_change_over_to_below_range(
@pytest.mark.parametrize(
("above", "below"),
(
[
(5, 10),
(5, "input_number.value_10"),
("input_number.value_5", 10),
("input_number.value_5", "input_number.value_10"),
),
],
)
async def test_if_fires_on_entity_change_over_to_below_above_range(
hass: HomeAssistant, calls, above, below
@ -690,7 +690,7 @@ async def test_if_fires_on_entity_change_over_to_below_above_range(
assert len(calls) == 0
@pytest.mark.parametrize("below", (100, "input_number.value_100"))
@pytest.mark.parametrize("below", [100, "input_number.value_100"])
async def test_if_not_fires_if_entity_not_match(
hass: HomeAssistant, calls, below
) -> None:
@ -745,7 +745,7 @@ async def test_if_not_fires_and_warns_if_below_entity_unknown(
assert caplog.record_tuples[0][1] == logging.WARNING
@pytest.mark.parametrize("below", (10, "input_number.value_10"))
@pytest.mark.parametrize("below", [10, "input_number.value_10"])
async def test_if_fires_on_entity_change_below_with_attribute(
hass: HomeAssistant, calls, below
) -> None:
@ -773,7 +773,7 @@ async def test_if_fires_on_entity_change_below_with_attribute(
assert len(calls) == 1
@pytest.mark.parametrize("below", (10, "input_number.value_10"))
@pytest.mark.parametrize("below", [10, "input_number.value_10"])
async def test_if_not_fires_on_entity_change_not_below_with_attribute(
hass: HomeAssistant, calls, below
) -> None:
@ -798,7 +798,7 @@ async def test_if_not_fires_on_entity_change_not_below_with_attribute(
assert len(calls) == 0
@pytest.mark.parametrize("below", (10, "input_number.value_10"))
@pytest.mark.parametrize("below", [10, "input_number.value_10"])
async def test_if_fires_on_attribute_change_with_attribute_below(
hass: HomeAssistant, calls, below
) -> None:
@ -827,7 +827,7 @@ async def test_if_fires_on_attribute_change_with_attribute_below(
assert len(calls) == 1
@pytest.mark.parametrize("below", (10, "input_number.value_10"))
@pytest.mark.parametrize("below", [10, "input_number.value_10"])
async def test_if_not_fires_on_attribute_change_with_attribute_not_below(
hass: HomeAssistant, calls, below
) -> None:
@ -853,7 +853,7 @@ async def test_if_not_fires_on_attribute_change_with_attribute_not_below(
assert len(calls) == 0
@pytest.mark.parametrize("below", (10, "input_number.value_10"))
@pytest.mark.parametrize("below", [10, "input_number.value_10"])
async def test_if_not_fires_on_entity_change_with_attribute_below(
hass: HomeAssistant, calls, below
) -> None:
@ -879,7 +879,7 @@ async def test_if_not_fires_on_entity_change_with_attribute_below(
assert len(calls) == 0
@pytest.mark.parametrize("below", (10, "input_number.value_10"))
@pytest.mark.parametrize("below", [10, "input_number.value_10"])
async def test_if_not_fires_on_entity_change_with_not_attribute_below(
hass: HomeAssistant, calls, below
) -> None:
@ -905,7 +905,7 @@ async def test_if_not_fires_on_entity_change_with_not_attribute_below(
assert len(calls) == 0
@pytest.mark.parametrize("below", (10, "input_number.value_10"))
@pytest.mark.parametrize("below", [10, "input_number.value_10"])
async def test_fires_on_attr_change_with_attribute_below_and_multiple_attr(
hass: HomeAssistant, calls, below
) -> None:
@ -937,7 +937,7 @@ async def test_fires_on_attr_change_with_attribute_below_and_multiple_attr(
assert len(calls) == 1
@pytest.mark.parametrize("below", (10, "input_number.value_10"))
@pytest.mark.parametrize("below", [10, "input_number.value_10"])
async def test_template_list(hass: HomeAssistant, calls, below) -> None:
"""Test template list."""
hass.states.async_set("test.entity", "entity", {"test_attribute": [11, 15, 11]})
@ -963,7 +963,7 @@ async def test_template_list(hass: HomeAssistant, calls, below) -> None:
assert len(calls) == 1
@pytest.mark.parametrize("below", (10.0, "input_number.value_10"))
@pytest.mark.parametrize("below", [10.0, "input_number.value_10"])
async def test_template_string(hass: HomeAssistant, calls, below) -> None:
"""Test template string."""
assert await async_setup_component(
@ -1036,12 +1036,12 @@ async def test_not_fires_on_attr_change_with_attr_not_below_multiple_attr(
@pytest.mark.parametrize(
("above", "below"),
(
[
(8, 12),
(8, "input_number.value_12"),
("input_number.value_8", 12),
("input_number.value_8", "input_number.value_12"),
),
],
)
async def test_if_action(hass: HomeAssistant, calls, above, below) -> None:
"""Test if action."""
@ -1084,12 +1084,12 @@ async def test_if_action(hass: HomeAssistant, calls, above, below) -> None:
@pytest.mark.parametrize(
("above", "below"),
(
[
(8, 12),
(8, "input_number.value_12"),
("input_number.value_8", 12),
("input_number.value_8", "input_number.value_12"),
),
],
)
async def test_if_fails_setup_bad_for(hass: HomeAssistant, calls, above, below) -> None:
"""Test for setup failure for bad for."""
@ -1140,12 +1140,12 @@ async def test_if_fails_setup_for_without_above_below(
@pytest.mark.parametrize(
("above", "below"),
(
[
(8, 12),
(8, "input_number.value_12"),
("input_number.value_8", 12),
("input_number.value_8", "input_number.value_12"),
),
],
)
async def test_if_not_fires_on_entity_change_with_for(
hass: HomeAssistant, freezer: FrozenDateTimeFactory, calls, above, below
@ -1180,12 +1180,12 @@ async def test_if_not_fires_on_entity_change_with_for(
@pytest.mark.parametrize(
("above", "below"),
(
[
(8, 12),
(8, "input_number.value_12"),
("input_number.value_8", 12),
("input_number.value_8", "input_number.value_12"),
),
],
)
async def test_if_not_fires_on_entities_change_with_for_after_stop(
hass: HomeAssistant, calls, above, below
@ -1241,12 +1241,12 @@ async def test_if_not_fires_on_entities_change_with_for_after_stop(
@pytest.mark.parametrize(
("above", "below"),
(
[
(8, 12),
(8, "input_number.value_12"),
("input_number.value_8", 12),
("input_number.value_8", "input_number.value_12"),
),
],
)
async def test_if_fires_on_entity_change_with_for_attribute_change(
hass: HomeAssistant, freezer: FrozenDateTimeFactory, calls, above, below
@ -1287,12 +1287,12 @@ async def test_if_fires_on_entity_change_with_for_attribute_change(
@pytest.mark.parametrize(
("above", "below"),
(
[
(8, 12),
(8, "input_number.value_12"),
("input_number.value_8", 12),
("input_number.value_8", "input_number.value_12"),
),
],
)
async def test_if_fires_on_entity_change_with_for(
hass: HomeAssistant, calls, above, below
@ -1325,7 +1325,7 @@ async def test_if_fires_on_entity_change_with_for(
assert len(calls) == 1
@pytest.mark.parametrize("above", (10, "input_number.value_10"))
@pytest.mark.parametrize("above", [10, "input_number.value_10"])
async def test_wait_template_with_trigger(hass: HomeAssistant, calls, above) -> None:
"""Test using wait template with 'trigger.entity_id'."""
hass.states.async_set("test.entity", "0")
@ -1368,12 +1368,12 @@ async def test_wait_template_with_trigger(hass: HomeAssistant, calls, above) ->
@pytest.mark.parametrize(
("above", "below"),
(
[
(8, 12),
(8, "input_number.value_12"),
("input_number.value_8", 12),
("input_number.value_8", "input_number.value_12"),
),
],
)
async def test_if_fires_on_entities_change_no_overlap(
hass: HomeAssistant, freezer: FrozenDateTimeFactory, calls, above, below
@ -1423,12 +1423,12 @@ async def test_if_fires_on_entities_change_no_overlap(
@pytest.mark.parametrize(
("above", "below"),
(
[
(8, 12),
(8, "input_number.value_12"),
("input_number.value_8", 12),
("input_number.value_8", "input_number.value_12"),
),
],
)
async def test_if_fires_on_entities_change_overlap(
hass: HomeAssistant, freezer: FrozenDateTimeFactory, calls, above, below
@ -1489,12 +1489,12 @@ async def test_if_fires_on_entities_change_overlap(
@pytest.mark.parametrize(
("above", "below"),
(
[
(8, 12),
(8, "input_number.value_12"),
("input_number.value_8", 12),
("input_number.value_8", "input_number.value_12"),
),
],
)
async def test_if_fires_on_change_with_for_template_1(
hass: HomeAssistant, calls, above, below
@ -1530,12 +1530,12 @@ async def test_if_fires_on_change_with_for_template_1(
@pytest.mark.parametrize(
("above", "below"),
(
[
(8, 12),
(8, "input_number.value_12"),
("input_number.value_8", 12),
("input_number.value_8", "input_number.value_12"),
),
],
)
async def test_if_fires_on_change_with_for_template_2(
hass: HomeAssistant, calls, above, below
@ -1571,12 +1571,12 @@ async def test_if_fires_on_change_with_for_template_2(
@pytest.mark.parametrize(
("above", "below"),
(
[
(8, 12),
(8, "input_number.value_12"),
("input_number.value_8", 12),
("input_number.value_8", "input_number.value_12"),
),
],
)
async def test_if_fires_on_change_with_for_template_3(
hass: HomeAssistant, calls, above, below
@ -1650,12 +1650,12 @@ async def test_if_not_fires_on_error_with_for_template(
@pytest.mark.parametrize(
("above", "below"),
(
[
(8, 12),
(8, "input_number.value_12"),
("input_number.value_8", 12),
("input_number.value_8", "input_number.value_12"),
),
],
)
async def test_invalid_for_template(hass: HomeAssistant, calls, above, below) -> None:
"""Test for invalid for template."""
@ -1687,12 +1687,12 @@ async def test_invalid_for_template(hass: HomeAssistant, calls, above, below) ->
@pytest.mark.parametrize(
("above", "below"),
(
[
(8, 12),
(8, "input_number.value_12"),
("input_number.value_8", 12),
("input_number.value_8", "input_number.value_12"),
),
],
)
async def test_if_fires_on_entities_change_overlap_for_template(
hass: HomeAssistant, freezer: FrozenDateTimeFactory, calls, above, below
@ -1788,7 +1788,7 @@ async def test_schema_unacceptable_entities(hass: HomeAssistant) -> None:
)
@pytest.mark.parametrize("above", (3, "input_number.value_3"))
@pytest.mark.parametrize("above", [3, "input_number.value_3"])
async def test_attribute_if_fires_on_entity_change_with_both_filters(
hass: HomeAssistant, calls, above
) -> None:
@ -1817,7 +1817,7 @@ async def test_attribute_if_fires_on_entity_change_with_both_filters(
assert len(calls) == 1
@pytest.mark.parametrize("above", (3, "input_number.value_3"))
@pytest.mark.parametrize("above", [3, "input_number.value_3"])
async def test_attribute_if_not_fires_on_entities_change_with_for_after_stop(
hass: HomeAssistant, calls, above
) -> None:
@ -1855,7 +1855,7 @@ async def test_attribute_if_not_fires_on_entities_change_with_for_after_stop(
@pytest.mark.parametrize(
("above", "below"),
((8, 12),),
[(8, 12)],
)
async def test_variables_priority(
hass: HomeAssistant, freezer: FrozenDateTimeFactory, calls, above, below
@ -1912,7 +1912,7 @@ async def test_variables_priority(
assert calls[0].data["some"] == "test.entity_1 - 0:00:05"
@pytest.mark.parametrize("multiplier", (1, 5))
@pytest.mark.parametrize("multiplier", [1, 5])
async def test_template_variable(hass: HomeAssistant, calls, multiplier) -> None:
"""Test template variable."""
hass.states.async_set("test.entity", "entity", {"test_attribute": [11, 15, 11]})

View file

@ -42,7 +42,7 @@ async def setup_repairs(hass):
@pytest.mark.parametrize(
("ha_version", "supervisor_info", "expected_alerts"),
(
[
(
"2022.7.0",
{"version": "2022.11.0"},
@ -93,7 +93,7 @@ async def setup_repairs(hass):
("sochain", "sochain"),
],
),
),
],
)
async def test_alerts(
hass: HomeAssistant,
@ -182,7 +182,7 @@ async def test_alerts(
"initial_alerts",
"late_alerts",
),
(
[
(
"2022.7.0",
{"version": "2022.11.0"},
@ -282,7 +282,7 @@ async def test_alerts(
("sochain", "sochain"),
],
),
),
],
)
async def test_alerts_refreshed_on_component_load(
hass: HomeAssistant,
@ -399,7 +399,7 @@ async def test_alerts_refreshed_on_component_load(
@pytest.mark.parametrize(
("ha_version", "fixture", "expected_alerts"),
(
[
(
"2022.7.0",
"alerts_no_integrations.json",
@ -415,7 +415,7 @@ async def test_alerts_refreshed_on_component_load(
("hikvision", "hikvision"),
],
),
),
],
)
async def test_bad_alerts(
hass: HomeAssistant,
@ -503,7 +503,7 @@ async def test_no_alerts(
@pytest.mark.parametrize(
("ha_version", "fixture_1", "expected_alerts_1", "fixture_2", "expected_alerts_2"),
(
[
(
"2022.7.0",
"alerts_1.json",
@ -564,7 +564,7 @@ async def test_no_alerts(
("sochain", "sochain"),
],
),
),
],
)
async def test_alerts_change(
hass: HomeAssistant,

View file

@ -53,7 +53,7 @@ def mock_zha_config_flow_setup() -> Generator[None, None, None]:
@pytest.mark.parametrize(
("onboarded", "num_entries", "num_flows"), ((False, 1, 0), (True, 0, 1))
("onboarded", "num_entries", "num_flows"), [(False, 1, 0), (True, 0, 1)]
)
async def test_setup_entry(
mock_zha_config_flow_setup,

View file

@ -16,7 +16,7 @@ from tests.common import MockConfigEntry, MockModule, mock_integration
@pytest.mark.parametrize(
("onboarded", "num_entries", "num_flows"), ((False, 1, 0), (True, 0, 1))
("onboarded", "num_entries", "num_flows"), [(False, 1, 0), (True, 0, 1)]
)
async def test_setup_entry(
hass: HomeAssistant, onboarded, num_entries, num_flows, addon_store_info

View file

@ -615,7 +615,7 @@ async def test_light_restore(
@pytest.mark.parametrize(
("supported_color_modes", "state_props", "turn_on_props_with_brightness"),
[
[
(
[ColorMode.COLOR_TEMP, ColorMode.RGBW],
{
ATTR_RGBW_COLOR: (128, 50, 0, 255),
@ -625,8 +625,8 @@ async def test_light_restore(
ATTR_COLOR_MODE: ColorMode.RGBW,
},
{ATTR_HS_COLOR: (145, 75), ATTR_BRIGHTNESS_PCT: 25},
],
[
),
(
[ColorMode.COLOR_TEMP, ColorMode.RGBWW],
{
ATTR_RGBWW_COLOR: (128, 50, 0, 255, 255),
@ -636,7 +636,7 @@ async def test_light_restore(
ATTR_COLOR_MODE: ColorMode.RGBWW,
},
{ATTR_HS_COLOR: (145, 75), ATTR_BRIGHTNESS_PCT: 25},
],
),
],
)
async def test_light_rgb_with_color_temp(
@ -735,7 +735,7 @@ async def test_light_rgb_with_color_temp(
@pytest.mark.parametrize(
("supported_color_modes", "state_props", "turn_on_props_with_brightness"),
[
[
(
[ColorMode.RGBW],
{
ATTR_RGBW_COLOR: (128, 50, 0, 255),
@ -745,8 +745,8 @@ async def test_light_rgb_with_color_temp(
ATTR_COLOR_MODE: ColorMode.RGBW,
},
{ATTR_RGBW_COLOR: (0, 0, 0, 191)},
],
[
),
(
[ColorMode.RGBWW],
{
ATTR_RGBWW_COLOR: (128, 50, 0, 255, 255),
@ -756,7 +756,7 @@ async def test_light_rgb_with_color_temp(
ATTR_COLOR_MODE: ColorMode.RGBWW,
},
{ATTR_RGBWW_COLOR: (0, 0, 0, 165, 26)},
],
),
],
)
async def test_light_rgbwx_with_color_temp_and_brightness(
@ -932,7 +932,7 @@ async def test_light_rgb_or_w_lights(
@pytest.mark.parametrize(
("supported_color_modes", "state_props"),
[
[
(
[ColorMode.COLOR_TEMP, ColorMode.RGBW],
{
ATTR_RGBW_COLOR: (128, 50, 0, 255),
@ -941,8 +941,8 @@ async def test_light_rgb_or_w_lights(
ATTR_BRIGHTNESS: 255,
ATTR_COLOR_MODE: ColorMode.RGBW,
},
],
[
),
(
[ColorMode.COLOR_TEMP, ColorMode.RGBWW],
{
ATTR_RGBWW_COLOR: (128, 50, 0, 255, 255),
@ -951,7 +951,7 @@ async def test_light_rgb_or_w_lights(
ATTR_BRIGHTNESS: 255,
ATTR_COLOR_MODE: ColorMode.RGBWW,
},
],
),
],
)
async def test_light_rgb_with_white_switch_to_temp(

View file

@ -30,11 +30,11 @@ async def mock_http_client(hass: HomeAssistant, aiohttp_client: ClientSessionGen
@pytest.mark.parametrize(
("url", "canonical_url"),
(
[
("//a", "//a"),
("///a", "///a"),
("/c:\\a\\b", "/c:%5Ca%5Cb"),
),
],
)
async def test_static_path_blocks_anchors(
hass: HomeAssistant,

View file

@ -102,7 +102,7 @@ async def test_already_configured(
@pytest.mark.parametrize(
("exception", "errors", "data_patch"),
(
[
(ConnectionError(), {CONF_URL: "unknown"}, {}),
(requests.exceptions.SSLError(), {CONF_URL: "ssl_error_try_plain"}, {}),
(
@ -110,7 +110,7 @@ async def test_already_configured(
{CONF_URL: "ssl_error_try_unverified"},
{CONF_VERIFY_SSL: True},
),
),
],
)
async def test_connection_errors(
hass: HomeAssistant,
@ -158,7 +158,7 @@ def login_requests_mock(requests_mock):
@pytest.mark.parametrize(
("request_outcome", "fixture_override", "errors"),
(
[
(
{
"text": f"<error><code>{LoginErrorEnum.USERNAME_WRONG}</code><message/></error>",
@ -202,7 +202,7 @@ def login_requests_mock(requests_mock):
{},
{CONF_URL: "connection_timeout"},
),
),
],
)
async def test_login_error(
hass: HomeAssistant, login_requests_mock, request_outcome, fixture_override, errors
@ -224,7 +224,7 @@ async def test_login_error(
assert result["errors"] == errors
@pytest.mark.parametrize("scheme", ("http", "https"))
@pytest.mark.parametrize("scheme", ["http", "https"])
async def test_success(hass: HomeAssistant, login_requests_mock, scheme: str) -> None:
"""Test successful flow provides entry creation data."""
user_input = {
@ -257,7 +257,7 @@ async def test_success(hass: HomeAssistant, login_requests_mock, scheme: str) ->
@pytest.mark.parametrize(
("requests_mock_request_kwargs", "upnp_data", "expected_result"),
(
[
(
{
"method": ANY,
@ -304,7 +304,7 @@ async def test_success(hass: HomeAssistant, login_requests_mock, scheme: str) ->
"reason": "unsupported_device",
},
),
),
],
)
async def test_ssdp(
hass: HomeAssistant,
@ -346,7 +346,7 @@ async def test_ssdp(
@pytest.mark.parametrize(
("login_response_text", "expected_result", "expected_entry_data"),
(
[
(
"<response>OK</response>",
{
@ -364,7 +364,7 @@ async def test_ssdp(
},
{**FIXTURE_USER_INPUT, CONF_PASSWORD: "invalid-password"},
),
),
],
)
async def test_reauth(
hass: HomeAssistant,

View file

@ -7,13 +7,13 @@ from homeassistant.components.huawei_lte import device_tracker
@pytest.mark.parametrize(
("value", "expected"),
(
[
("HTTP", "http"),
("ID", "id"),
("IPAddress", "ip_address"),
("HTTPResponse", "http_response"),
("foo_bar", "foo_bar"),
),
],
)
def test_better_snakecase(value, expected) -> None:
"""Test that better snakecase works better."""

View file

@ -11,11 +11,11 @@ from homeassistant.const import (
@pytest.mark.parametrize(
("value", "expected"),
(
[
("-71 dBm", (-71, SIGNAL_STRENGTH_DECIBELS_MILLIWATT)),
("15dB", (15, SIGNAL_STRENGTH_DECIBELS)),
(">=-51dBm", (-51, SIGNAL_STRENGTH_DECIBELS_MILLIWATT)),
),
],
)
def test_format_default(value, expected) -> None:
"""Test that default formatter copes with expected values."""

View file

@ -95,12 +95,12 @@ async def test_get_actions(
@pytest.mark.parametrize(
("hidden_by", "entity_category"),
(
[
(RegistryEntryHider.INTEGRATION, None),
(RegistryEntryHider.USER, None),
(None, EntityCategory.CONFIG),
(None, EntityCategory.DIAGNOSTIC),
),
],
)
async def test_get_actions_hidden_auxiliary(
hass: HomeAssistant,

View file

@ -103,12 +103,12 @@ async def test_get_conditions(
@pytest.mark.parametrize(
("hidden_by", "entity_category"),
(
[
(RegistryEntryHider.INTEGRATION, None),
(RegistryEntryHider.USER, None),
(None, EntityCategory.CONFIG),
(None, EntityCategory.DIAGNOSTIC),
),
],
)
async def test_get_conditions_hidden_auxiliary(
hass: HomeAssistant,

View file

@ -103,12 +103,12 @@ async def test_get_triggers(
@pytest.mark.parametrize(
("hidden_by", "entity_category"),
(
[
(RegistryEntryHider.INTEGRATION, None),
(RegistryEntryHider.USER, None),
(None, EntityCategory.CONFIG),
(None, EntityCategory.DIAGNOSTIC),
),
],
)
async def test_get_triggers_hidden_auxiliary(
hass: HomeAssistant,

View file

@ -186,7 +186,7 @@ async def test_intent_set_mode_tests_feature(hass: HomeAssistant) -> None:
assert len(mode_calls) == 0
@pytest.mark.parametrize("available_modes", (["home", "away"], None))
@pytest.mark.parametrize("available_modes", [["home", "away"], None])
async def test_intent_set_unknown_mode(
hass: HomeAssistant, available_modes: list[str] | None
) -> None:

View file

@ -363,11 +363,11 @@ async def test_bluetooth_step_already_in_progress(hass: HomeAssistant) -> None:
@pytest.mark.parametrize(
("exc", "error"),
(
[
(BleakError, "cannot_connect"),
(Exception, "unknown"),
(improv_ble_errors.CharacteristicMissingError, "characteristic_missing"),
),
],
)
async def test_can_identify_fails(hass: HomeAssistant, exc, error) -> None:
"""Test bluetooth flow with error."""
@ -398,11 +398,11 @@ async def test_can_identify_fails(hass: HomeAssistant, exc, error) -> None:
@pytest.mark.parametrize(
("exc", "error"),
(
[
(BleakError, "cannot_connect"),
(Exception, "unknown"),
(improv_ble_errors.CharacteristicMissingError, "characteristic_missing"),
),
],
)
async def test_identify_fails(hass: HomeAssistant, exc, error) -> None:
"""Test bluetooth flow with error."""
@ -441,11 +441,11 @@ async def test_identify_fails(hass: HomeAssistant, exc, error) -> None:
@pytest.mark.parametrize(
("exc", "error"),
(
[
(BleakError, "cannot_connect"),
(Exception, "unknown"),
(improv_ble_errors.CharacteristicMissingError, "characteristic_missing"),
),
],
)
async def test_need_authorization_fails(hass: HomeAssistant, exc, error) -> None:
"""Test bluetooth flow with error."""
@ -485,11 +485,11 @@ async def test_need_authorization_fails(hass: HomeAssistant, exc, error) -> None
@pytest.mark.parametrize(
("exc", "error"),
(
[
(BleakError, "cannot_connect"),
(Exception, "unknown"),
(improv_ble_errors.CharacteristicMissingError, "characteristic_missing"),
),
],
)
async def test_authorize_fails(hass: HomeAssistant, exc, error) -> None:
"""Test bluetooth flow with error."""
@ -577,12 +577,12 @@ async def _test_provision_error(hass: HomeAssistant, exc) -> None:
@pytest.mark.parametrize(
("exc", "error"),
(
[
(BleakError, "cannot_connect"),
(Exception, "unknown"),
(improv_ble_errors.CharacteristicMissingError, "characteristic_missing"),
(improv_ble_errors.ProvisioningFailed(Error.UNKNOWN_ERROR), "unknown"),
),
],
)
async def test_provision_fails(hass: HomeAssistant, exc, error) -> None:
"""Test bluetooth flow with error."""
@ -595,7 +595,7 @@ async def test_provision_fails(hass: HomeAssistant, exc, error) -> None:
@pytest.mark.parametrize(
("exc", "error"),
((improv_ble_errors.ProvisioningFailed(Error.NOT_AUTHORIZED), "unknown"),),
[(improv_ble_errors.ProvisioningFailed(Error.NOT_AUTHORIZED), "unknown")],
)
async def test_provision_not_authorized(hass: HomeAssistant, exc, error) -> None:
"""Test bluetooth flow with error."""
@ -619,12 +619,12 @@ async def test_provision_not_authorized(hass: HomeAssistant, exc, error) -> None
@pytest.mark.parametrize(
("exc", "error"),
(
[
(
improv_ble_errors.ProvisioningFailed(Error.UNABLE_TO_CONNECT),
"unable_to_connect",
),
),
],
)
async def test_provision_retry(hass: HomeAssistant, exc, error) -> None:
"""Test bluetooth flow with error."""

View file

@ -12,7 +12,7 @@ from homeassistant.data_entry_flow import FlowResultType
from tests.common import MockConfigEntry
@pytest.mark.parametrize("platform", ("sensor",))
@pytest.mark.parametrize("platform", ["sensor"])
async def test_config_flow(hass: HomeAssistant, platform) -> None:
"""Test the config flow."""
input_sensor_entity_id = "sensor.input"
@ -74,7 +74,7 @@ def get_suggested(schema, key):
raise Exception
@pytest.mark.parametrize("platform", ("sensor",))
@pytest.mark.parametrize("platform", ["sensor"])
async def test_options(hass: HomeAssistant, platform) -> None:
"""Test reconfiguring."""
# Setup the config entry

View file

@ -9,7 +9,7 @@ from homeassistant.helpers import entity_registry as er
from tests.common import MockConfigEntry
@pytest.mark.parametrize("platform", ("sensor",))
@pytest.mark.parametrize("platform", ["sensor"])
async def test_setup_and_remove_config_entry(
hass: HomeAssistant,
entity_registry: er.EntityRegistry,

View file

@ -28,7 +28,7 @@ async def test_form(hass: HomeAssistant) -> None:
@pytest.mark.parametrize(
("side_effect", "errors"),
(
[
(
InvalidClientID(client_id="test_id"),
{"base": "invalid_auth"},
@ -41,7 +41,7 @@ async def test_form(hass: HomeAssistant) -> None:
RuntimeError,
{"base": "unknown"},
),
),
],
)
async def test_form_errors(
hass: HomeAssistant,

View file

@ -83,12 +83,12 @@ async def test_get_actions(
@pytest.mark.parametrize(
("hidden_by", "entity_category"),
(
[
(RegistryEntryHider.INTEGRATION, None),
(RegistryEntryHider.USER, None),
(None, EntityCategory.CONFIG),
(None, EntityCategory.DIAGNOSTIC),
),
],
)
async def test_get_actions_hidden_auxiliary(
hass: HomeAssistant,

View file

@ -69,12 +69,12 @@ async def test_get_conditions(
@pytest.mark.parametrize(
("hidden_by", "entity_category"),
(
[
(RegistryEntryHider.INTEGRATION, None),
(RegistryEntryHider.USER, None),
(None, EntityCategory.CONFIG),
(None, EntityCategory.DIAGNOSTIC),
),
],
)
async def test_get_conditions_hidden_auxiliary(
hass: HomeAssistant,

View file

@ -69,12 +69,12 @@ async def test_get_triggers(
@pytest.mark.parametrize(
("hidden_by", "entity_category"),
(
[
(RegistryEntryHider.INTEGRATION, None),
(RegistryEntryHider.USER, None),
(None, EntityCategory.CONFIG),
(None, EntityCategory.DIAGNOSTIC),
),
],
)
async def test_get_triggers_hidden_auxiliary(
hass: HomeAssistant,

View file

@ -438,7 +438,7 @@ async def test_services(
@pytest.mark.parametrize(
("profile_name", "last_call", "expected_data"),
(
[
(
"test",
"turn_on",
@ -501,7 +501,7 @@ async def test_services(
light.ATTR_TRANSITION: 5.3,
},
),
),
],
)
async def test_light_profiles(
hass: HomeAssistant,
@ -591,7 +591,7 @@ async def test_default_profiles_group(
"expected_params_state_was_off",
"expected_params_state_was_on",
),
(
[
(
# No turn on params, should apply profile
{},
@ -774,7 +774,7 @@ async def test_default_profiles_group(
light.ATTR_TRANSITION: 1,
},
),
),
],
)
async def test_default_profiles_light(
hass: HomeAssistant,
@ -1128,7 +1128,7 @@ invalid_no_brightness_no_color_no_transition,,,
assert invalid_profile_name not in profiles.data
@pytest.mark.parametrize("light_state", (STATE_ON, STATE_OFF))
@pytest.mark.parametrize("light_state", [STATE_ON, STATE_OFF])
async def test_light_backwards_compatibility_supported_color_modes(
hass: HomeAssistant, light_state, enable_custom_integrations: None
) -> None:

View file

@ -127,7 +127,7 @@ async def test_reproducing_states(
@pytest.mark.parametrize(
"color_mode",
(
[
light.ColorMode.COLOR_TEMP,
light.ColorMode.BRIGHTNESS,
light.ColorMode.HS,
@ -138,7 +138,7 @@ async def test_reproducing_states(
light.ColorMode.UNKNOWN,
light.ColorMode.WHITE,
light.ColorMode.XY,
),
],
)
async def test_filter_color_modes(
hass: HomeAssistant, caplog: pytest.LogCaptureFixture, color_mode
@ -195,7 +195,7 @@ async def test_filter_color_modes(
@pytest.mark.parametrize(
"saved_state",
(
[
NONE_BRIGHTNESS,
NONE_EFFECT,
NONE_COLOR_TEMP,
@ -204,7 +204,7 @@ async def test_filter_color_modes(
NONE_RGBW_COLOR,
NONE_RGBWW_COLOR,
NONE_XY_COLOR,
),
],
)
async def test_filter_none(hass: HomeAssistant, saved_state) -> None:
"""Test filtering of parameters which are None."""

View file

@ -47,10 +47,10 @@ async def test_unload_entry(hass: HomeAssistant, mock_account: MagicMock) -> Non
@pytest.mark.parametrize(
("side_effect", "expected_state"),
(
[
(LitterRobotLoginException, ConfigEntryState.SETUP_ERROR),
(LitterRobotException, ConfigEntryState.SETUP_RETRY),
),
],
)
async def test_entry_not_setup(
hass: HomeAssistant,

View file

@ -90,12 +90,12 @@ async def test_get_actions(
@pytest.mark.parametrize(
("hidden_by", "entity_category"),
(
[
(RegistryEntryHider.INTEGRATION, None),
(RegistryEntryHider.USER, None),
(None, EntityCategory.CONFIG),
(None, EntityCategory.DIAGNOSTIC),
),
],
)
async def test_get_actions_hidden_auxiliary(
hass: HomeAssistant,

View file

@ -77,12 +77,12 @@ async def test_get_conditions(
@pytest.mark.parametrize(
("hidden_by", "entity_category"),
(
[
(RegistryEntryHider.INTEGRATION, None),
(RegistryEntryHider.USER, None),
(None, EntityCategory.CONFIG),
(None, EntityCategory.DIAGNOSTIC),
),
],
)
async def test_get_conditions_hidden_auxiliary(
hass: HomeAssistant,

View file

@ -76,12 +76,12 @@ async def test_get_triggers(
@pytest.mark.parametrize(
("hidden_by", "entity_category"),
(
[
(RegistryEntryHider.INTEGRATION, None),
(RegistryEntryHider.USER, None),
(None, EntityCategory.CONFIG),
(None, EntityCategory.DIAGNOSTIC),
),
],
)
async def test_get_triggers_hidden_auxiliary(
hass: HomeAssistant,

View file

@ -181,7 +181,7 @@ async def test_lovelace_from_yaml(
assert len(events) == 1
@pytest.mark.parametrize("url_path", ("test-panel", "test-panel-no-sidebar"))
@pytest.mark.parametrize("url_path", ["test-panel", "test-panel-no-sidebar"])
async def test_dashboard_from_yaml(
hass: HomeAssistant, hass_ws_client: WebSocketGenerator, url_path
) -> None:

View file

@ -473,7 +473,7 @@ async def test_zeroconf_not_lutron_device(hass: HomeAssistant) -> None:
@pytest.mark.parametrize(
"source", (config_entries.SOURCE_ZEROCONF, config_entries.SOURCE_HOMEKIT)
"source", [config_entries.SOURCE_ZEROCONF, config_entries.SOURCE_HOMEKIT]
)
async def test_zeroconf(hass: HomeAssistant, source, tmp_path: Path) -> None:
"""Test starting a flow from discovery."""

View file

@ -79,12 +79,12 @@ async def test_get_conditions(
@pytest.mark.parametrize(
("hidden_by", "entity_category"),
(
[
(RegistryEntryHider.INTEGRATION, None),
(RegistryEntryHider.USER, None),
(None, EntityCategory.CONFIG),
(None, EntityCategory.DIAGNOSTIC),
),
],
)
async def test_get_conditions_hidden_auxiliary(
hass: HomeAssistant,

View file

@ -87,12 +87,12 @@ async def test_get_triggers(
@pytest.mark.parametrize(
("hidden_by", "entity_category"),
(
[
(RegistryEntryHider.INTEGRATION, None),
(RegistryEntryHider.USER, None),
(None, EntityCategory.CONFIG),
(None, EntityCategory.DIAGNOSTIC),
),
],
)
async def test_get_triggers_hidden_auxiliary(
hass: HomeAssistant,

View file

@ -240,14 +240,14 @@ async def test_group_members_available_when_off(hass: HomeAssistant) -> None:
@pytest.mark.parametrize(
("input", "expected"),
(
[
(True, MediaPlayerEnqueue.ADD),
(False, MediaPlayerEnqueue.PLAY),
("play", MediaPlayerEnqueue.PLAY),
("next", MediaPlayerEnqueue.NEXT),
("add", MediaPlayerEnqueue.ADD),
("replace", MediaPlayerEnqueue.REPLACE),
),
],
)
async def test_enqueue_rewrite(hass: HomeAssistant, input, expected) -> None:
"""Test that group_members are still available when media_player is off."""

View file

@ -12,7 +12,7 @@ from homeassistant.data_entry_flow import FlowResultType
from tests.common import MockConfigEntry
@pytest.mark.parametrize("platform", ("sensor",))
@pytest.mark.parametrize("platform", ["sensor"])
async def test_config_flow(hass: HomeAssistant, platform: str) -> None:
"""Test the config flow."""
input_sensors = ["sensor.input_one", "sensor.input_two"]
@ -66,7 +66,7 @@ def get_suggested(schema, key):
raise Exception
@pytest.mark.parametrize("platform", ("sensor",))
@pytest.mark.parametrize("platform", ["sensor"])
async def test_options(hass: HomeAssistant, platform: str) -> None:
"""Test reconfiguring."""
hass.states.async_set("sensor.input_one", "10")

View file

@ -9,7 +9,7 @@ from homeassistant.helpers import entity_registry as er
from tests.common import MockConfigEntry
@pytest.mark.parametrize("platform", ("sensor",))
@pytest.mark.parametrize("platform", ["sensor"])
async def test_setup_and_remove_config_entry(
hass: HomeAssistant,
entity_registry: er.EntityRegistry,

View file

@ -120,7 +120,7 @@ async def test_create_cloud_hook_on_setup(
await _test_create_cloud_hook(hass, hass_admin_user, {}, True, additional_steps)
@pytest.mark.parametrize("exception", (CloudNotAvailable, ValueError))
@pytest.mark.parametrize("exception", [CloudNotAvailable, ValueError])
async def test_remove_cloudhook(
hass: HomeAssistant,
hass_admin_user: MockUser,

View file

@ -19,10 +19,10 @@ from homeassistant.util.unit_system import METRIC_SYSTEM, US_CUSTOMARY_SYSTEM
@pytest.mark.parametrize(
("unit_system", "state_unit", "state1", "state2"),
(
[
(METRIC_SYSTEM, UnitOfTemperature.CELSIUS, "100", "123"),
(US_CUSTOMARY_SYSTEM, UnitOfTemperature.FAHRENHEIT, "212", "253"),
),
],
)
async def test_sensor(
hass: HomeAssistant,
@ -128,7 +128,7 @@ async def test_sensor(
@pytest.mark.parametrize(
("unique_id", "unit_system", "state_unit", "state1", "state2"),
(
[
("battery_temperature", METRIC_SYSTEM, UnitOfTemperature.CELSIUS, "100", "123"),
(
"battery_temperature",
@ -145,7 +145,7 @@ async def test_sensor(
"212",
"123",
),
),
],
)
async def test_sensor_migration(
hass: HomeAssistant,

View file

@ -348,13 +348,13 @@ async def test_webhook_returns_error_incorrect_json(
@pytest.mark.parametrize(
("msg", "generate_response"),
(
[
(RENDER_TEMPLATE, lambda hass: {"one": "Hello world"}),
(
{"type": "get_zones", "data": {}},
lambda hass: [hass.states.get("zone.home").as_dict()],
),
),
],
)
async def test_webhook_handle_decryption(
hass: HomeAssistant, webhook_client, create_registrations, msg, generate_response

Some files were not shown because too many files have changed in this diff Show more