diff --git a/tests/components/tado/test_helper.py b/tests/components/tado/test_helper.py
index 7f798e3797c..e766c007c2c 100644
--- a/tests/components/tado/test_helper.py
+++ b/tests/components/tado/test_helper.py
@@ -124,7 +124,7 @@ async def test_duration_enabled_without_tado_default(
async def test_duration_enabled_with_tado_default(
hass: HomeAssistant, entry: ConfigEntry, tado: Tado
) -> None:
- """Test overlay method selection when ended up with timer overlay and None duration."""
+ """Test overlay method selection with timer overlay and None duration."""
zone_fallback = CONST_OVERLAY_TIMER
expected_duration = 45000
tado = dummy_tado_connector(
diff --git a/tests/components/tasmota/test_common.py b/tests/components/tasmota/test_common.py
index a63879aeb2d..d23c031b9aa 100644
--- a/tests/components/tasmota/test_common.py
+++ b/tests/components/tasmota/test_common.py
@@ -59,7 +59,7 @@ DEFAULT_CONFIG = {
"20": 0, # Update of Dimmer/Color/CT without turning power on
"30": 0, # Enforce Home Assistant auto-discovery as light
"68": 0, # Multi-channel PWM instead of a single light
- "73": 0, # Enable Buttons decoupling and send multi-press and hold MQTT messages
+ "73": 0, # Enable Buttons decoupling and send multi-press
"82": 0, # Reduce the CT range from 153..500 to 200.380
"114": 0, # Enable sending switch MQTT messages
},
@@ -94,7 +94,7 @@ DEFAULT_CONFIG_9_0_0_3 = {
"20": 0, # Update of Dimmer/Color/CT without turning power on
"30": 0, # Enforce Home Assistant auto-discovery as light
"68": 0, # Multi-channel PWM instead of a single light
- "73": 0, # Enable Buttons decoupling and send multi-press and hold MQTT messages
+ "73": 0, # Enable Buttons decoupling and send multi-press
"80": 0, # Blinds and shutters support
"82": 0, # Reduce the CT range from 153..500 to 200.380
},
diff --git a/tests/components/tasmota/test_config_flow.py b/tests/components/tasmota/test_config_flow.py
index 4d5b655a9c9..435fb9b662f 100644
--- a/tests/components/tasmota/test_config_flow.py
+++ b/tests/components/tasmota/test_config_flow.py
@@ -30,8 +30,10 @@ async def test_mqtt_abort_invalid_topic(
discovery_info = MqttServiceInfo(
topic="tasmota/discovery/DC4F220848A2/bla",
payload=(
- '{"ip":"192.168.0.136","dn":"Tasmota","fn":["Tasmota",null,null,null,null,'
- 'null,null,null],"hn":"tasmota_0848A2","mac":"DC4F220848A2","md":"Sonoff Basic",'
+ '{"ip":"192.168.0.136","dn":"Tasmota",'
+ '"fn":["Tasmota",null,null,null,null,'
+ 'null,null,null],"hn":"tasmota_0848A2",'
+ '"mac":"DC4F220848A2","md":"Sonoff Basic",'
'"ty":0,"if":0,"ofln":"Offline","onln":"Online","state":["OFF","ON",'
'"TOGGLE","HOLD"],"sw":"9.4.0.4","t":"tasmota_0848A2","ft":"%topic%/%prefix%/",'
'"tp":["cmnd","stat","tele"],"rl":[1,0,0,0,0,0,0,0],"swc":[-1,-1,-1,-1,-1,-1,-1,-1],'
@@ -67,8 +69,10 @@ async def test_mqtt_abort_invalid_topic(
discovery_info = MqttServiceInfo(
topic="tasmota/discovery/DC4F220848A2/config",
payload=(
- '{"ip":"192.168.0.136","dn":"Tasmota","fn":["Tasmota",null,null,null,null,'
- 'null,null,null],"hn":"tasmota_0848A2","mac":"DC4F220848A2","md":"Sonoff Basic",'
+ '{"ip":"192.168.0.136","dn":"Tasmota",'
+ '"fn":["Tasmota",null,null,null,null,'
+ 'null,null,null],"hn":"tasmota_0848A2",'
+ '"mac":"DC4F220848A2","md":"Sonoff Basic",'
'"ty":0,"if":0,"ofln":"Offline","onln":"Online","state":["OFF","ON",'
'"TOGGLE","HOLD"],"sw":"9.4.0.4","t":"tasmota_0848A2","ft":"%topic%/%prefix%/",'
'"tp":["cmnd","stat","tele"],"rl":[1,0,0,0,0,0,0,0],"swc":[-1,-1,-1,-1,-1,-1,-1,-1],'
@@ -92,8 +96,10 @@ async def test_mqtt_setup(hass: HomeAssistant, mqtt_mock: MqttMockHAClient) -> N
discovery_info = MqttServiceInfo(
topic="tasmota/discovery/DC4F220848A2/config",
payload=(
- '{"ip":"192.168.0.136","dn":"Tasmota","fn":["Tasmota",null,null,null,null,'
- 'null,null,null],"hn":"tasmota_0848A2","mac":"DC4F220848A2","md":"Sonoff Basic",'
+ '{"ip":"192.168.0.136","dn":"Tasmota",'
+ '"fn":["Tasmota",null,null,null,null,'
+ 'null,null,null],"hn":"tasmota_0848A2",'
+ '"mac":"DC4F220848A2","md":"Sonoff Basic",'
'"ty":0,"if":0,"ofln":"Offline","onln":"Online","state":["OFF","ON",'
'"TOGGLE","HOLD"],"sw":"9.4.0.4","t":"tasmota_0848A2","ft":"%topic%/%prefix%/",'
'"tp":["cmnd","stat","tele"],"rl":[1,0,0,0,0,0,0,0],"swc":[-1,-1,-1,-1,-1,-1,-1,-1],'
diff --git a/tests/components/tasmota/test_discovery.py b/tests/components/tasmota/test_discovery.py
index 35ea79f7749..1c987f7466c 100644
--- a/tests/components/tasmota/test_discovery.py
+++ b/tests/components/tasmota/test_discovery.py
@@ -400,7 +400,8 @@ async def test_device_remove_multiple_config_entries_2(
assert device_entry.config_entries == {tasmota_entry.entry_id}
mqtt_mock.async_publish.assert_not_called()
- # Remove other config entry from the other device - Tasmota should not do any cleanup
+ # Remove other config entry from the other device
+ # Tasmota should not do any cleanup
device_registry.async_update_device(
other_device_entry.id, remove_config_entry_id=mock_entry.entry_id
)
diff --git a/tests/components/tasmota/test_fan.py b/tests/components/tasmota/test_fan.py
index 9237f4b7d29..c6fa2d9afb9 100644
--- a/tests/components/tasmota/test_fan.py
+++ b/tests/components/tasmota/test_fan.py
@@ -188,7 +188,8 @@ async def test_sending_mqtt_commands(
assert state.attributes["percentage"] == 0
mqtt_mock.async_publish.reset_mock()
- # Finally, turn the fan on again and verify MQTT message is sent with last known speed
+ # Finally, turn the fan on again and verify MQTT message is sent
+ # with last known speed
await common.async_turn_on(hass, "fan.tasmota")
mqtt_mock.async_publish.assert_called_once_with(
"tasmota_49A3BC/cmnd/FanSpeed", "3", 0, False, message_expiry_interval=None
diff --git a/tests/components/tasmota/test_sensor.py b/tests/components/tasmota/test_sensor.py
index 098cdbbf8d1..3e922f8d3ad 100644
--- a/tests/components/tasmota/test_sensor.py
+++ b/tests/components/tasmota/test_sensor.py
@@ -201,7 +201,8 @@ TEMPERATURE_SENSOR_CONFIG = {
["sensor.tasmota_tx23_speed_act", "sensor.tasmota_tx23_dir_card"],
(
'{"TX23":{"Speed":{"Act":"12.3"},"Dir": {"Card": "WSW"}}}',
- '{"StatusSNS":{"TX23":{"Speed":{"Act":"23.4"},"Dir": {"Card": "ESE"}}}}',
+ '{"StatusSNS":{"TX23":{"Speed":{"Act":"23.4"},'
+ '"Dir": {"Card": "ESE"}}}}',
),
),
(
@@ -239,8 +240,10 @@ TEMPERATURE_SENSOR_CONFIG = {
LIST_SENSOR_CONFIG_2,
["sensor.tasmota_energy_total_0", "sensor.tasmota_energy_total_1"],
(
- '{"ENERGY":{"Total":[1.2, 3.4],"TotalStartTime":"2018-11-23T15:33:47"}}',
- '{"StatusSNS":{"ENERGY":{"Total":[5.6, 7.8],"TotalStartTime":"2018-11-23T16:33:47"}}}',
+ '{"ENERGY":{"Total":[1.2, 3.4],'
+ '"TotalStartTime":"2018-11-23T15:33:47"}}',
+ '{"StatusSNS":{"ENERGY":{"Total":[5.6, 7.8],'
+ '"TotalStartTime":"2018-11-23T16:33:47"}}}',
),
),
# Test dict Total sensors
@@ -251,8 +254,11 @@ TEMPERATURE_SENSOR_CONFIG = {
"sensor.tasmota_energy_total_phase2",
],
(
- '{"ENERGY":{"Total":{"Phase1":1.2, "Phase2":3.4},"TotalStartTime":"2018-11-23T15:33:47"}}',
- '{"StatusSNS":{"ENERGY":{"Total":{"Phase1":5.6, "Phase2":7.8},"TotalStartTime":"2018-11-23T15:33:47"}}}',
+ '{"ENERGY":{"Total":{"Phase1":1.2, "Phase2":3.4},'
+ '"TotalStartTime":"2018-11-23T15:33:47"}}',
+ '{"StatusSNS":{"ENERGY":'
+ '{"Total":{"Phase1":5.6, "Phase2":7.8},'
+ '"TotalStartTime":"2018-11-23T15:33:47"}}}',
),
),
(
@@ -292,7 +298,8 @@ TEMPERATURE_SENSOR_CONFIG = {
),
),
),
- # Test we automatically set state class to measurement on unknown numerical sensors
+ # Test we automatically set state class to measurement on
+ # unknown numerical sensors
(
DEFAULT_SENSOR_CONFIG_UNKNOWN,
[
diff --git a/tests/components/technove/test_config_flow.py b/tests/components/technove/test_config_flow.py
index ba4ef452163..fda021051d8 100644
--- a/tests/components/technove/test_config_flow.py
+++ b/tests/components/technove/test_config_flow.py
@@ -75,7 +75,7 @@ async def test_connection_error(hass: HomeAssistant, mock_technove: MagicMock) -
async def test_full_user_flow_with_error(
hass: HomeAssistant, mock_technove: MagicMock
) -> None:
- """Test the full manual user flow from start to finish with some errors in the middle."""
+ """Test the full manual user flow with some errors in the middle."""
mock_technove.update.side_effect = TechnoVEConnectionError
result = await hass.config_entries.flow.async_init(
DOMAIN,
diff --git a/tests/components/tedee/test_lock.py b/tests/components/tedee/test_lock.py
index 0d5b02e9e92..e414fba209e 100644
--- a/tests/components/tedee/test_lock.py
+++ b/tests/components/tedee/test_lock.py
@@ -134,7 +134,10 @@ async def test_lock_without_pullspring(
with pytest.raises(
ServiceNotSupported,
- match=f"Entity lock.lock_2c3d does not support action {LOCK_DOMAIN}.{SERVICE_OPEN}",
+ match=(
+ "Entity lock.lock_2c3d does not support action"
+ f" {LOCK_DOMAIN}.{SERVICE_OPEN}"
+ ),
):
await hass.services.async_call(
LOCK_DOMAIN,
diff --git a/tests/components/telegram_bot/conftest.py b/tests/components/telegram_bot/conftest.py
index 4da5d841a52..06c665ce856 100644
--- a/tests/components/telegram_bot/conftest.py
+++ b/tests/components/telegram_bot/conftest.py
@@ -255,7 +255,7 @@ def update_message_text():
@pytest.fixture
def unauthorized_update_message_text(update_message_text):
- """Fixture for mocking an incoming update of type message/text that is not in our `allowed_chat_ids`."""
+ """Fixture for mocking an incoming unauthorized message/text."""
update_message_text["message"]["from"]["id"] = 1234
update_message_text["message"]["chat"]["id"] = 1234
return update_message_text
@@ -285,7 +285,7 @@ def update_callback_query():
@pytest.fixture
def update_callback_inline_keyboard():
- """Fixture for mocking an incoming update of type callback_query from inline keyboard button."""
+ """Fixture for mocking a callback_query from inline keyboard."""
return {
"update_id": 1,
"callback_query": {
@@ -382,7 +382,7 @@ async def webhook_bot(
@pytest.fixture
def mock_polling_calls() -> Generator[None]:
- """Fixture for setting up the polling platform using appropriate config and mocks."""
+ """Fixture for setting up the polling platform with config and mocks."""
with patch(
"homeassistant.components.telegram_bot.polling.ApplicationBuilder"
) as application_builder_class:
diff --git a/tests/components/telegram_bot/test_config_flow.py b/tests/components/telegram_bot/test_config_flow.py
index df398efca00..3da3336c35e 100644
--- a/tests/components/telegram_bot/test_config_flow.py
+++ b/tests/components/telegram_bot/test_config_flow.py
@@ -743,7 +743,7 @@ async def test_subentry_flow_broadcast_update_error(
mock_broadcast_config_entry: MockConfigEntry,
mock_external_calls: None,
) -> None:
- """Test subentry flow where broadcast bot encounter error while receiving messages."""
+ """Test subentry flow where broadcast bot errors receiving messages."""
mock_broadcast_config_entry.add_to_hass(hass)
assert await hass.config_entries.async_setup(mock_broadcast_config_entry.entry_id)
diff --git a/tests/components/telegram_bot/test_telegram_bot.py b/tests/components/telegram_bot/test_telegram_bot.py
index 035cfe0c88c..6716bfd7bc3 100644
--- a/tests/components/telegram_bot/test_telegram_bot.py
+++ b/tests/components/telegram_bot/test_telegram_bot.py
@@ -205,7 +205,7 @@ async def test_polling_platform_init_failed(
async def test_send_message(
hass: HomeAssistant, webhook_bot, service: str, input: dict[str, Any]
) -> None:
- """Test the send_message service. Tests any service that does not require files to be sent."""
+ """Test services that do not require files to be sent."""
context = Context()
events = async_capture_events(hass, "telegram_sent")
@@ -375,7 +375,12 @@ async def test_send_sticker_partial_error(
assert mock_send_sticker.call_count == 2
assert err.value.translation_key == "multiple_errors"
assert err.value.translation_placeholders == {
- "errors": "`entity_id` notify.mock_title_mock_chat_1: mock network error\n`entity_id` notify.mock_title_mock_chat_2: mock network error"
+ "errors": (
+ "`entity_id` notify.mock_title_mock_chat_1:"
+ " mock network error\n"
+ "`entity_id` notify.mock_title_mock_chat_2:"
+ " mock network error"
+ )
}
@@ -623,7 +628,7 @@ async def test_webhook_endpoint_generates_telegram_text_event(
update_message_text,
mock_generate_secret_token,
) -> None:
- """POST to the configured webhook endpoint and assert fired `telegram_text` event."""
+ """POST to webhook endpoint and assert fired telegram_text event."""
client = await hass_client()
events = async_capture_events(hass, "telegram_text")
@@ -650,7 +655,7 @@ async def test_webhook_endpoint_generates_telegram_command_event(
update_message_command,
mock_generate_secret_token,
) -> None:
- """POST to the configured webhook endpoint and assert fired `telegram_command` event."""
+ """POST to webhook endpoint and assert fired telegram_command event."""
client = await hass_client()
events = async_capture_events(hass, "telegram_command")
@@ -752,7 +757,7 @@ async def test_webhook_endpoint_generates_telegram_attachment_event(
mock_generate_secret_token: str,
attachment_type: str,
) -> None:
- """POST to the configured webhook endpoint and assert fired `telegram_attachment` event for photo and document."""
+ """POST to webhook and assert fired telegram_attachment event."""
client = await hass_client()
events = async_capture_events(hass, "telegram_attachment")
update_message_attachment = await async_load_fixture(
@@ -790,13 +795,14 @@ async def test_polling_platform_message_text_update(
update_message_text,
mock_external_calls: None,
) -> None:
- """Provide the `BaseTelegramBot.update_handler` with an `Update` and assert fired `telegram_text` event."""
+ """Test update_handler with an Update fires telegram_text event."""
events = async_capture_events(hass, "telegram_text")
with patch(
"homeassistant.components.telegram_bot.polling.ApplicationBuilder"
) as application_builder_class:
- # Set up the integration with the polling platform inside the patch context manager.
+ # Set up the integration with the polling platform inside
+ # the patch context manager.
application = (
application_builder_class.return_value.bot.return_value.build.return_value
)
@@ -1941,10 +1947,24 @@ async def test_migrate_chat_id(
"action": "telegram_bot.send_message",
"action_origin": expected_action_origin,
"chat_ids": "654321",
- "telegram_bot_entities_url": "/config/entities?domain=telegram_bot",
- "example_old": "```yaml\naction: send_message\ndata:\n target: # to be updated\n - 1234567890\n...\n```",
- "example_new_entity_id": "```yaml\naction: send_message\ndata:\n entity_id:\n - notify.telegram_bot_1234567890_1234567890 # replace with your notify entity\n...\n```",
- "example_new_chat_id": "```yaml\naction: send_message\ndata:\n chat_id:\n - 1234567890 # replace with your chat_id\n...\n```",
+ "telegram_bot_entities_url": ("/config/entities?domain=telegram_bot"),
+ "example_old": (
+ "```yaml\naction: send_message\ndata:\n"
+ " target: # to be updated\n"
+ " - 1234567890\n...\n```"
+ ),
+ "example_new_entity_id": (
+ "```yaml\naction: send_message\ndata:\n"
+ " entity_id:\n"
+ " - notify.telegram_bot_1234567890_1234567890"
+ " # replace with your notify entity\n...\n```"
+ ),
+ "example_new_chat_id": (
+ "```yaml\naction: send_message\ndata:\n"
+ " chat_id:\n"
+ " - 1234567890"
+ " # replace with your chat_id\n...\n```"
+ ),
}
# fix the issue via repair flow
@@ -1972,9 +1992,23 @@ async def test_migrate_chat_id(
"action_origin": expected_action_origin,
"chat_ids": "654321",
"telegram_bot_entities_url": "/config/entities?domain=telegram_bot",
- "example_old": "```yaml\naction: send_message\ndata:\n target: # to be updated\n - 1234567890\n...\n```",
- "example_new_entity_id": "```yaml\naction: send_message\ndata:\n entity_id:\n - notify.telegram_bot_1234567890_1234567890 # replace with your notify entity\n...\n```",
- "example_new_chat_id": "```yaml\naction: send_message\ndata:\n chat_id:\n - 1234567890 # replace with your chat_id\n...\n```",
+ "example_old": (
+ "```yaml\naction: send_message\ndata:\n"
+ " target: # to be updated\n"
+ " - 1234567890\n...\n```"
+ ),
+ "example_new_entity_id": (
+ "```yaml\naction: send_message\ndata:\n"
+ " entity_id:\n"
+ " - notify.telegram_bot_1234567890_1234567890"
+ " # replace with your notify entity\n...\n```"
+ ),
+ "example_new_chat_id": (
+ "```yaml\naction: send_message\ndata:\n"
+ " chat_id:\n"
+ " - 1234567890"
+ " # replace with your chat_id\n...\n```"
+ ),
},
"last_step": None,
"preview": None,
diff --git a/tests/components/telegram_bot/test_webhooks.py b/tests/components/telegram_bot/test_webhooks.py
index ed9e1c03696..9f2ebeae511 100644
--- a/tests/components/telegram_bot/test_webhooks.py
+++ b/tests/components/telegram_bot/test_webhooks.py
@@ -45,7 +45,8 @@ async def test_set_webhooks_failed(
# first fail with exception, second fail with False
assert mock_set_webhook.call_count == 2
- # SETUP_ERROR is result of RuntimeError("Failed to register webhook with Telegram") in webhooks.py
+ # SETUP_ERROR is result of RuntimeError(
+ # "Failed to register webhook with Telegram") in webhooks.py
assert mock_webhooks_config_entry.state is ConfigEntryState.SETUP_ERROR
# test fail after retries
diff --git a/tests/components/tellduslive/test_config_flow.py b/tests/components/tellduslive/test_config_flow.py
index abce2858bf3..77223483e80 100644
--- a/tests/components/tellduslive/test_config_flow.py
+++ b/tests/components/tellduslive/test_config_flow.py
@@ -180,7 +180,7 @@ async def test_step_import_load_json(hass: HomeAssistant, mock_tellduslive) -> N
@pytest.mark.parametrize("supports_local_api", [False])
async def test_step_disco_no_local_api(hass: HomeAssistant, mock_tellduslive) -> None:
- """Test that we trigger when configuring from discovery, not supporting local api."""
+ """Test configuring from discovery, not supporting local api."""
flow = init_config_flow(hass)
flow.context = {"source": SOURCE_DISCOVERY}
diff --git a/tests/components/teltonika/test_config_flow.py b/tests/components/teltonika/test_config_flow.py
index 83235384afe..c4eec00d4e6 100644
--- a/tests/components/teltonika/test_config_flow.py
+++ b/tests/components/teltonika/test_config_flow.py
@@ -560,7 +560,7 @@ async def test_form_user_flow_rut240(
mock_teltasync_client: MagicMock,
rut240_device_info: UnauthorizedStatusData,
) -> None:
- """RUT240 firmware omits device_identifier; the flow falls back to mnf_info.serial."""
+ """RUT240 firmware omits device_identifier; falls back to serial."""
mock_teltasync_client.get_device_info.return_value = rut240_device_info
mock_teltasync_client.validate_credentials.return_value = True
@@ -695,7 +695,7 @@ async def test_dhcp_discovery_apiv1_already_configured_aborts(
mock_config_entry: MockConfigEntry,
rut240_device_info: UnauthorizedStatusData,
) -> None:
- """An API v1.0 (e.g. RUT240) known to the device registry by MAC aborts before dhcp_confirm."""
+ """API v1.0 RUT240 known by MAC aborts before dhcp_confirm."""
mock_config_entry.add_to_hass(hass)
device_registry.async_get_or_create(
config_entry_id=mock_config_entry.entry_id,
diff --git a/tests/components/temperature/test_trigger.py b/tests/components/temperature/test_trigger.py
index 8de4317a1f5..ef133d96e62 100644
--- a/tests/components/temperature/test_trigger.py
+++ b/tests/components/temperature/test_trigger.py
@@ -156,7 +156,7 @@ async def test_temperature_trigger_sensor_behavior_any(
trigger_options: dict[str, Any],
states: list[TriggerStateDescription],
) -> None:
- """Test temperature trigger fires for sensor entities with device_class temperature."""
+ """Test trigger fires for sensor entities with device_class temperature."""
await assert_trigger_behavior_any(
hass,
target_entities=target_sensors,
@@ -195,7 +195,7 @@ async def test_temperature_trigger_sensor_crossed_threshold_behavior_first(
trigger_options: dict[str, Any],
states: list[TriggerStateDescription],
) -> None:
- """Test temperature crossed_threshold trigger fires on the first sensor state change."""
+ """Test crossed_threshold trigger fires on first sensor state change."""
await assert_trigger_behavior_first(
hass,
target_entities=target_sensors,
@@ -234,7 +234,7 @@ async def test_temperature_trigger_sensor_crossed_threshold_behavior_last(
trigger_options: dict[str, Any],
states: list[TriggerStateDescription],
) -> None:
- """Test temperature crossed_threshold trigger fires when the last sensor changes state."""
+ """Test crossed_threshold trigger fires on last sensor state change."""
await assert_trigger_behavior_last(
hass,
target_entities=target_sensors,
@@ -324,7 +324,7 @@ async def test_temperature_trigger_climate_crossed_threshold_behavior_first(
trigger_options: dict[str, Any],
states: list[TriggerStateDescription],
) -> None:
- """Test temperature crossed_threshold trigger fires on the first climate state change."""
+ """Test crossed_threshold trigger fires on first climate state change."""
await assert_trigger_behavior_first(
hass,
target_entities=target_climates,
@@ -364,7 +364,7 @@ async def test_temperature_trigger_climate_crossed_threshold_behavior_last(
trigger_options: dict[str, Any],
states: list[TriggerStateDescription],
) -> None:
- """Test temperature crossed_threshold trigger fires when the last climate changes state."""
+ """Test crossed_threshold trigger fires on last climate state change."""
await assert_trigger_behavior_last(
hass,
target_entities=target_climates,
@@ -454,7 +454,7 @@ async def test_temperature_trigger_water_heater_crossed_threshold_behavior_first
trigger_options: dict[str, Any],
states: list[TriggerStateDescription],
) -> None:
- """Test temperature crossed_threshold trigger fires on the first water_heater state change."""
+ """Test crossed_threshold fires on first water_heater state change."""
await assert_trigger_behavior_first(
hass,
target_entities=target_water_heaters,
@@ -494,7 +494,7 @@ async def test_temperature_trigger_water_heater_crossed_threshold_behavior_last(
trigger_options: dict[str, Any],
states: list[TriggerStateDescription],
) -> None:
- """Test temperature crossed_threshold trigger fires when the last water_heater changes state."""
+ """Test crossed_threshold fires on last water_heater state change."""
await assert_trigger_behavior_last(
hass,
target_entities=target_water_heaters,
@@ -587,7 +587,7 @@ async def test_temperature_trigger_weather_crossed_threshold_behavior_first(
trigger_options: dict[str, Any],
states: list[TriggerStateDescription],
) -> None:
- """Test temperature crossed_threshold trigger fires on the first weather state change."""
+ """Test crossed_threshold trigger fires on first weather state change."""
await assert_trigger_behavior_first(
hass,
target_entities=target_weathers,
@@ -628,7 +628,7 @@ async def test_temperature_trigger_weather_crossed_threshold_behavior_last(
trigger_options: dict[str, Any],
states: list[TriggerStateDescription],
) -> None:
- """Test temperature crossed_threshold trigger fires when the last weather changes state."""
+ """Test crossed_threshold fires on last weather state change."""
await assert_trigger_behavior_last(
hass,
target_entities=target_weathers,
@@ -648,7 +648,7 @@ async def test_temperature_trigger_weather_crossed_threshold_behavior_last(
async def test_temperature_trigger_unit_conversion_sensor_celsius_to_fahrenheit(
hass: HomeAssistant,
) -> None:
- """Test temperature trigger converts sensor value from °C to °F for threshold comparison."""
+ """Test trigger converts sensor value from C to F for comparison."""
calls: list[str] = []
entity_id = "sensor.test_temp"
@@ -706,7 +706,7 @@ async def test_temperature_trigger_unit_conversion_sensor_celsius_to_fahrenheit(
async def test_temperature_trigger_unit_conversion_sensor_fahrenheit_to_celsius(
hass: HomeAssistant,
) -> None:
- """Test temperature trigger converts sensor value from °F to °C for threshold comparison."""
+ """Test trigger converts sensor value from F to C for comparison."""
calls: list[str] = []
entity_id = "sensor.test_temp"
@@ -768,7 +768,8 @@ async def test_temperature_trigger_unit_conversion_changed(
calls: list[str] = []
entity_id = "sensor.test_temp"
- # Sensor reports in °C, trigger configured in °F: above 68°F (20°C), below 77°F (25°C)
+ # Sensor reports in C, trigger configured in F:
+ # above 68F (20C), below 77F (25C)
hass.states.async_set(
entity_id,
"18",
@@ -839,7 +840,8 @@ async def test_temperature_trigger_unit_conversion_weather(
calls: list[str] = []
entity_id = "weather.test"
- # Weather reports temperature in °F, trigger configured in °C with threshold above 25°C
+ # Weather reports in F, trigger configured in C with threshold
+ # above 25C
hass.states.async_set(
entity_id,
"sunny",
diff --git a/tests/components/template/conftest.py b/tests/components/template/conftest.py
index 3ed5b666a55..bdcdd0ab344 100644
--- a/tests/components/template/conftest.py
+++ b/tests/components/template/conftest.py
@@ -96,7 +96,7 @@ async def async_setup_legacy_platforms(
count: int,
config: ConfigType | list[ConfigType],
) -> None:
- """Do setup of any legacy platform that supports a keyed dictionary of template entities."""
+ """Do setup of any legacy platform with keyed template entities."""
if slug is None:
# Lock and Weather platforms do not use a slug
if isinstance(config, list):
@@ -301,12 +301,13 @@ async def setup_and_test_nested_unique_id(
entity_config: ConfigType | None,
state_template: str | None = None,
) -> None:
- """Setup 2 entities with unique unique_ids in a template section that contains a unique_id.
+ """Setup 2 entities with unique_ids in a template section with a unique_id.
- The test will verify that 2 entities are created where the unique_id appends the
- section unique_id to each entity unique_id.
+ The test will verify that 2 entities are created where the unique_id
+ appends the section unique_id to each entity unique_id.
- The entity_config should not provide name or unique_id, those are added automatically.
+ The entity_config should not provide name or unique_id, those are
+ added automatically.
"""
state_config = {"state": state_template} if state_template else {}
entities = [
diff --git a/tests/components/template/test_binary_sensor.py b/tests/components/template/test_binary_sensor.py
index 2d8ca746cc9..49fbcad943e 100644
--- a/tests/components/template/test_binary_sensor.py
+++ b/tests/components/template/test_binary_sensor.py
@@ -1186,7 +1186,7 @@ async def test_trigger_with_negative_time_periods(
async def test_trigger_template_delay_with_multiple_triggers(
hass: HomeAssistant, delay_state: str, freezer: FrozenDateTimeFactory
) -> None:
- """Test trigger based binary sensor with multiple triggers occurring during the delay."""
+ """Test trigger based binary sensor with multiple triggers during delay."""
for _ in range(10):
# State should still be unknown
state = hass.states.get(TEST_BINARY_SENSOR.entity_id)
diff --git a/tests/components/template/test_blueprint.py b/tests/components/template/test_blueprint.py
index 79cd4f15c4f..0a653dfd257 100644
--- a/tests/components/template/test_blueprint.py
+++ b/tests/components/template/test_blueprint.py
@@ -229,7 +229,7 @@ async def test_reload_template_when_blueprint_changes(hass: HomeAssistant) -> No
async def test_init_attribute_variables_from_blueprint(hass: HomeAssistant) -> None:
- """Test a state based blueprint initializes icon, name, and picture with variables."""
+ """Test blueprint initializes icon, name, and picture with variables."""
blueprint = "test_init_attribute_variables.yaml"
source = "switch.foo"
entity_id = "sensor.foo"
diff --git a/tests/components/template/test_config.py b/tests/components/template/test_config.py
index 288998c962b..e8c33c67511 100644
--- a/tests/components/template/test_config.py
+++ b/tests/components/template/test_config.py
@@ -131,7 +131,8 @@ async def test_invalid_default_entity_id(
"auto_off": "00:00:01",
},
},
- "The auto_off option for template binary sensor: name: Template Binary Sensor",
+ "The auto_off option for template binary sensor:"
+ " name: Template Binary Sensor",
),
(
{
@@ -172,7 +173,8 @@ async def test_invalid_default_entity_id(
"auto_off": "00:00:01",
},
},
- "The auto_off option for template binary sensor: default_entity_id: binary_sensor.test_entity_id",
+ "The auto_off option for template binary sensor:"
+ " default_entity_id: binary_sensor.test_entity_id",
),
(
{
@@ -195,7 +197,8 @@ async def test_invalid_default_entity_id(
"auto_off": "00:00:01",
},
},
- "The auto_off option for template binary sensor: default_entity_id: binary_sensor.test_entity_id",
+ "The auto_off option for template binary sensor:"
+ " default_entity_id: binary_sensor.test_entity_id",
),
],
)
@@ -376,7 +379,7 @@ async def test_combined_trigger_variables(
async def test_state_init_attribute_variables(
hass: HomeAssistant,
) -> None:
- """Test a state based template entity initializes icon, name, and picture with variables."""
+ """Test state based template entity initializes attributes with variables."""
source = "switch.foo"
entity_id = "sensor.foo"
@@ -396,7 +399,9 @@ async def test_state_init_attribute_variables(
},
"name": "{{ state_attr(switch, 'friendly_name') }}",
"icon": "{{ on_icon if is_state(switch, 'on') else off_icon }}",
- "picture": "{{ on_picture if is_state(switch, 'on') else off_picture }}",
+ "picture": (
+ "{{ on_picture if is_state(switch, 'on') else off_picture }}"
+ ),
"state": "{{ is_state(switch, 'on') }}",
},
}
@@ -436,7 +441,8 @@ async def test_state_init_attribute_variables(
{
"trigger": {"trigger": "event", "event_type": "my_event"},
},
- "Invalid template configuration found, trigger option is missing matching domain",
+ "Invalid template configuration found, trigger option is"
+ " missing matching domain",
),
(
{
@@ -520,10 +526,24 @@ async def test_multiple_configuration_keys(
"action": "cover.stop_cover",
},
"default_entity_id": "cover.shades_reversed",
- "icon": "{% set s = states('cover.shades_curtain') %}\n{% if s == 'open' %}\n mdi:curtains-closed\n{% else %}\n mdi:curtains\n{% endif %}",
+ "icon": (
+ "{% set s = states('cover.shades_curtain') %}\n"
+ "{% if s == 'open' %}\n"
+ " mdi:curtains-closed\n"
+ "{% else %}\n"
+ " mdi:curtains\n"
+ "{% endif %}"
+ ),
"name": "Shades Reversed",
"unique_id": "c0223bcb-32c6-430e-a2c1-3545f8031796",
- "state": "{% set s = states('cover.shades_curtain') %}\n{% if s == 'open' %}\n closed\n{% elif s == 'closed' %}\n open\n{% elif s == 'opening' %}\n closing\n{% elif s == 'closing' %}\n opening\n{% else %}\n unknown\n{% endif %}",
+ "state": (
+ "{% set s = states('cover.shades_curtain') %}\n"
+ "{% if s == 'open' %}\n closed\n"
+ "{% elif s == 'closed' %}\n open\n"
+ "{% elif s == 'opening' %}\n closing\n"
+ "{% elif s == 'closing' %}\n opening\n"
+ "{% else %}\n unknown\n{% endif %}"
+ ),
}
]
},
diff --git a/tests/components/template/test_config_flow.py b/tests/components/template/test_config_flow.py
index 6284af157e2..b0256abc29e 100644
--- a/tests/components/template/test_config_flow.py
+++ b/tests/components/template/test_config_flow.py
@@ -73,7 +73,10 @@ BINARY_SENSOR_OPTIONS = {
(
"binary_sensor",
{
- "state": "{{ states('binary_sensor.one') == 'on' or states('binary_sensor.two') == 'on' }}"
+ "state": (
+ "{{ states('binary_sensor.one') == 'on'"
+ " or states('binary_sensor.two') == 'on' }}"
+ )
},
"on",
{"one": "on", "two": "off"},
@@ -85,7 +88,9 @@ BINARY_SENSOR_OPTIONS = {
(
"sensor",
{
- "state": "{{ float(states('sensor.one')) + float(states('sensor.two')) }}"
+ "state": (
+ "{{ float(states('sensor.one')) + float(states('sensor.two')) }}"
+ )
},
"50.0",
{"one": "30.0", "two": "20.0"},
@@ -570,10 +575,16 @@ async def test_config_flow_device(
(
"binary_sensor",
{
- "state": "{{ states('binary_sensor.one') == 'on' or states('binary_sensor.two') == 'on' }}"
+ "state": (
+ "{{ states('binary_sensor.one') == 'on'"
+ " or states('binary_sensor.two') == 'on' }}"
+ )
},
{
- "state": "{{ states('binary_sensor.one') == 'on' and states('binary_sensor.two') == 'on' }}"
+ "state": (
+ "{{ states('binary_sensor.one') == 'on'"
+ " and states('binary_sensor.two') == 'on' }}"
+ )
},
["on", "off"],
{"one": "on", "two": "off"},
@@ -585,10 +596,14 @@ async def test_config_flow_device(
(
"sensor",
{
- "state": "{{ float(states('sensor.one')) + float(states('sensor.two')) }}"
+ "state": (
+ "{{ float(states('sensor.one')) + float(states('sensor.two')) }}"
+ )
},
{
- "state": "{{ float(states('sensor.one')) - float(states('sensor.two')) }}"
+ "state": (
+ "{{ float(states('sensor.one')) - float(states('sensor.two')) }}"
+ )
},
["50.0", "10.0"],
{"one": "30.0", "two": "20.0"},
@@ -916,10 +931,16 @@ async def test_options(
(
"binary_sensor",
{
- "state": "{{ states('binary_sensor.one') == 'on' or states('binary_sensor.two') == 'on' }}"
+ "state": (
+ "{{ states('binary_sensor.one') == 'on'"
+ " or states('binary_sensor.two') == 'on' }}"
+ )
},
{
- "state": "{{ states('binary_sensor.one') == 'on' and states('binary_sensor.two') == 'on' }}"
+ "state": (
+ "{{ states('binary_sensor.one') == 'on'"
+ " and states('binary_sensor.two') == 'on' }}"
+ )
},
{"one": "on", "two": "off"},
{"device_class": "motion"},
@@ -1026,7 +1047,10 @@ async def test_options_remove_device_class(
[
(
"binary_sensor",
- "{{ states.binary_sensor.one.state == 'on' or states.binary_sensor.two.state == 'on' }}",
+ (
+ "{{ states.binary_sensor.one.state == 'on'"
+ " or states.binary_sensor.two.state == 'on' }}"
+ ),
{},
{"one": "on", "two": "off"},
["off", "on"],
@@ -1225,7 +1249,9 @@ EARLY_END_ERROR = "invalid template (TemplateSyntaxError: unexpected 'end of tem
),
"unit_of_measurement": (
"'None' is not a valid unit for device class 'energy'; "
- "expected one of 'cal', 'Gcal', 'GJ', 'GWh', 'J', 'kcal', 'kJ', 'kWh', 'Mcal', 'MJ', 'MWh', 'mWh', 'TWh', 'Wh'"
+ "expected one of 'cal', 'Gcal', 'GJ', 'GWh', 'J',"
+ " 'kcal', 'kJ', 'kWh', 'Mcal', 'MJ', 'MWh',"
+ " 'mWh', 'TWh', 'Wh'"
),
},
),
@@ -1504,8 +1530,14 @@ async def test_config_flow_preview_bad_state(
[
(
"binary_sensor",
- "{{ states('binary_sensor.one') == 'on' or states('binary_sensor.two') == 'on' }}",
- "{{ states('binary_sensor.one') == 'on' and states('binary_sensor.two') == 'on' }}",
+ (
+ "{{ states('binary_sensor.one') == 'on'"
+ " or states('binary_sensor.two') == 'on' }}"
+ ),
+ (
+ "{{ states('binary_sensor.one') == 'on'"
+ " and states('binary_sensor.two') == 'on' }}"
+ ),
{},
{},
{"one": "on", "two": "off"},
diff --git a/tests/components/template/test_cover.py b/tests/components/template/test_cover.py
index 6e23cb1d193..a91c259a21a 100644
--- a/tests/components/template/test_cover.py
+++ b/tests/components/template/test_cover.py
@@ -524,22 +524,26 @@ async def test_position_out_of_bounds(hass: HomeAssistant) -> None:
(
ConfigurationStyle.MODERN,
{},
- "Invalid config for 'template': must contain at least one of open_cover, set_cover_position.",
+ "Invalid config for 'template': must contain at least one"
+ " of open_cover, set_cover_position.",
),
(
ConfigurationStyle.MODERN,
OPEN_COVER,
- "Invalid config for 'template': some but not all values in the same group of inclusion 'open_or_close'",
+ "Invalid config for 'template': some but not all values"
+ " in the same group of inclusion 'open_or_close'",
),
(
ConfigurationStyle.TRIGGER,
{},
- "Invalid config for 'template': must contain at least one of open_cover, set_cover_position.",
+ "Invalid config for 'template': must contain at least one"
+ " of open_cover, set_cover_position.",
),
(
ConfigurationStyle.TRIGGER,
OPEN_COVER,
- "Invalid config for 'template': some but not all values in the same group of inclusion 'open_or_close'",
+ "Invalid config for 'template': some but not all values"
+ " in the same group of inclusion 'open_or_close'",
),
],
)
@@ -740,7 +744,10 @@ async def test_set_position_optimistic(
ConfigurationStyle.TRIGGER,
{
**SET_COVER_POSITION,
- "picture": "{{ 'foo.png' if is_state('sensor.test_state', 'open') else 'bar.png' }}",
+ "picture": (
+ "{{ 'foo.png' if is_state('sensor.test_state',"
+ " 'open') else 'bar.png' }}"
+ ),
},
),
],
@@ -1013,7 +1020,11 @@ async def test_state_gets_lowercased(hass: HomeAssistant) -> None:
(
1,
"{{ states.sensor.test_state.state }}",
- "mdi:window-shutter{{ '-open' if is_state('cover.test_template_cover', 'open') else '' }}",
+ (
+ "mdi:window-shutter{{ '-open'"
+ " if is_state('cover.test_template_cover', 'open')"
+ " else '' }}"
+ ),
)
],
)
diff --git a/tests/components/template/test_helpers.py b/tests/components/template/test_helpers.py
index a9103ba1444..9492be7a486 100644
--- a/tests/components/template/test_helpers.py
+++ b/tests/components/template/test_helpers.py
@@ -286,7 +286,7 @@ async def test_yaml_device_actions(
entity_registry: er.EntityRegistry,
calls: list,
) -> None:
- """Test device actions in platforms that support both trigger and modern configurations."""
+ """Test device actions in platforms supporting trigger and modern configs."""
await _setup_and_test_yaml_device_action(
hass,
style,
@@ -542,7 +542,7 @@ async def test_config_entry_device_actions(
async def test_platform_not_ready(
hass: HomeAssistant,
) -> None:
- """Test async_setup_template_platform raises PlatformNotReady when trigger object is None."""
+ """Test async_setup_template_platform raises PlatformNotReady."""
with pytest.raises(PlatformNotReady):
await async_setup_template_platform(
hass,
diff --git a/tests/components/template/test_init.py b/tests/components/template/test_init.py
index 46c9b2b78b2..aa0f66942f6 100644
--- a/tests/components/template/test_init.py
+++ b/tests/components/template/test_init.py
@@ -168,7 +168,7 @@ async def test_reloadable_stops_on_invalid_config(hass: HomeAssistant) -> None:
)
@pytest.mark.usefixtures("start_ha")
async def test_reloadable_handles_partial_valid_config(hass: HomeAssistant) -> None:
- """Test we can still setup valid sensors when configuration.yaml has a broken entry."""
+ """Test we can still setup valid sensors when config has a broken entry."""
hass.states.async_set("sensor.test_sensor", "mytest")
await hass.async_block_till_done()
assert hass.states.get("sensor.state").state == "mytest"
diff --git a/tests/components/template/test_number.py b/tests/components/template/test_number.py
index 4b44baaaba5..d23643ff64d 100644
--- a/tests/components/template/test_number.py
+++ b/tests/components/template/test_number.py
@@ -266,7 +266,9 @@ def _verify(
[
(
{
- CONF_ICON: "{% if states.number.test_state.state == '1' %}mdi:check{% endif %}",
+ CONF_ICON: (
+ "{% if states.number.test_state.state == '1' %}mdi:check{% endif %}"
+ ),
**TEST_REQUIRED,
},
ATTR_ICON,
@@ -274,7 +276,9 @@ def _verify(
),
(
{
- CONF_PICTURE: "{% if states.number.test_state.state == '1' %}check.jpg{% endif %}",
+ CONF_PICTURE: (
+ "{% if states.number.test_state.state == '1' %}check.jpg{% endif %}"
+ ),
**TEST_REQUIRED,
},
ATTR_ENTITY_PICTURE,
@@ -425,7 +429,9 @@ async def test_not_optimistic(hass: HomeAssistant) -> None:
{
"set_value": [],
"state": "{{ states('number.test_state') }}",
- "availability": "{{ is_state('binary_sensor.test_availability', 'on') }}",
+ "availability": (
+ "{{ is_state('binary_sensor.test_availability', 'on') }}"
+ ),
},
)
],
diff --git a/tests/components/template/test_select.py b/tests/components/template/test_select.py
index 7f6a629ef1d..03cf7b96b32 100644
--- a/tests/components/template/test_select.py
+++ b/tests/components/template/test_select.py
@@ -239,7 +239,10 @@ def _verify(
(
{
**TEST_OPTIONS,
- CONF_ICON: "{% if states.sensor.test_state.state == 'yes' %}mdi:check{% endif %}",
+ CONF_ICON: (
+ "{% if states.sensor.test_state.state == 'yes' %}"
+ "mdi:check{% endif %}"
+ ),
},
ATTR_ICON,
"mdi:check",
@@ -247,7 +250,10 @@ def _verify(
(
{
**TEST_OPTIONS,
- CONF_PICTURE: "{% if states.sensor.test_state.state == 'yes' %}check.jpg{% endif %}",
+ CONF_PICTURE: (
+ "{% if states.sensor.test_state.state == 'yes' %}"
+ "check.jpg{% endif %}"
+ ),
},
ATTR_ENTITY_PICTURE,
"check.jpg",
@@ -441,7 +447,9 @@ async def test_not_optimistic(hass: HomeAssistant) -> None:
"options": "{{ ['test', 'yes', 'no'] }}",
"select_option": [],
"state": "{{ states('sensor.test_state') }}",
- "availability": "{{ is_state('binary_sensor.test_availability', 'on') }}",
+ "availability": (
+ "{{ is_state('binary_sensor.test_availability', 'on') }}"
+ ),
},
)
],
diff --git a/tests/components/template/test_sensor.py b/tests/components/template/test_sensor.py
index c534fb05a42..586248dd397 100644
--- a/tests/components/template/test_sensor.py
+++ b/tests/components/template/test_sensor.py
@@ -261,7 +261,10 @@ async def test_icon_template(
("attribute_template", "before_update", "after_update"),
[
(
- "{{ '/local/sensor.png' if is_state('sensor.test_state', 'Works') else '' }}",
+ (
+ "{{ '/local/sensor.png'"
+ " if is_state('sensor.test_state', 'Works') else '' }}"
+ ),
"",
"/local/sensor.png",
),
@@ -305,7 +308,10 @@ async def test_entity_picture_template(
("attribute_template", "after_update"),
[
(
- "{{ 'It Works.' if is_state('sensor.test_state', 'Works') else 'test_template_sensor' }}",
+ (
+ "{{ 'It Works.' if is_state('sensor.test_state',"
+ " 'Works') else 'test_template_sensor' }}"
+ ),
"It Works.",
),
(
@@ -688,10 +694,31 @@ async def test_this_variable(hass: HomeAssistant, before: str, after: str) -> No
{
"template": {
"sensor": {
- "state": "{{ this.attributes.get('test', 'no-test!') }}: {{ this.entity_id }}",
- "icon": "mdi:{% if this.entity_id in states and 'friendly_name' in this.attributes %} {{this.attributes['friendly_name']}} {% else %}{{this.entity_id}}:{{this.entity_id in states}}{% endif %}",
- "name": "{% if this.entity_id in states and 'friendly_name' in this.attributes %} {{this.attributes['friendly_name']}} {% else %}{{this.entity_id}}:{{this.entity_id in states}}{% endif %}",
- "picture": "{% if this.entity_id in states and 'entity_picture' in this.attributes %} {{this.attributes['entity_picture']}} {% else %}{{this.entity_id}}:{{this.entity_id in states}}{% endif %}",
+ "state": (
+ "{{ this.attributes.get('test', 'no-test!') }}"
+ ": {{ this.entity_id }}"
+ ),
+ "icon": (
+ "mdi:{% if this.entity_id in states and"
+ " 'friendly_name' in this.attributes %}"
+ " {{this.attributes['friendly_name']}} "
+ "{% else %}{{this.entity_id}}:"
+ "{{this.entity_id in states}}{% endif %}"
+ ),
+ "name": (
+ "{% if this.entity_id in states and"
+ " 'friendly_name' in this.attributes %}"
+ " {{this.attributes['friendly_name']}} "
+ "{% else %}{{this.entity_id}}:"
+ "{{this.entity_id in states}}{% endif %}"
+ ),
+ "picture": (
+ "{% if this.entity_id in states and"
+ " 'entity_picture' in this.attributes %}"
+ " {{this.attributes['entity_picture']}} "
+ "{% else %}{{this.entity_id}}:"
+ "{{this.entity_id in states}}{% endif %}"
+ ),
"attributes": {"test": "{{ this.entity_id }}"},
},
},
@@ -753,10 +780,31 @@ async def test_this_variable_early_hass_not_running(
{
"template": {
"sensor": {
- "state": "{{ this.attributes.get('test', 'no-test!') }}: {{ this.entity_id }}",
- "icon": "mdi:{% if this.entity_id in states and 'friendly_name' in this.attributes %} {{this.attributes['friendly_name']}} {% else %}{{this.entity_id}}:{{this.entity_id in states}}{% endif %}",
- "name": "{% if this.entity_id in states and 'friendly_name' in this.attributes %} {{this.attributes['friendly_name']}} {% else %}{{this.entity_id}}:{{this.entity_id in states}}{% endif %}",
- "picture": "{% if this.entity_id in states and 'entity_picture' in this.attributes %} {{this.attributes['entity_picture']}} {% else %}{{this.entity_id}}:{{this.entity_id in states}}{% endif %}",
+ "state": (
+ "{{ this.attributes.get('test', 'no-test!') }}"
+ ": {{ this.entity_id }}"
+ ),
+ "icon": (
+ "mdi:{% if this.entity_id in states and"
+ " 'friendly_name' in this.attributes %}"
+ " {{this.attributes['friendly_name']}} "
+ "{% else %}{{this.entity_id}}:"
+ "{{this.entity_id in states}}{% endif %}"
+ ),
+ "name": (
+ "{% if this.entity_id in states and"
+ " 'friendly_name' in this.attributes %}"
+ " {{this.attributes['friendly_name']}} "
+ "{% else %}{{this.entity_id}}:"
+ "{{this.entity_id in states}}{% endif %}"
+ ),
+ "picture": (
+ "{% if this.entity_id in states and"
+ " 'entity_picture' in this.attributes %}"
+ " {{this.attributes['entity_picture']}} "
+ "{% else %}{{this.entity_id}}:"
+ "{{this.entity_id in states}}{% endif %}"
+ ),
"attributes": {"test": "{{ this.entity_id }}"},
},
},
@@ -828,17 +876,33 @@ async def test_self_referencing_sensor_loop(
[
(
{
- "state": "{{ ((states.sensor.test_template_sensor.state or 0) | int) + 1 }}",
- "icon": "{% if ((states.sensor.test_template_sensor.state or 0) | int) >= 1 %}mdi:greater{% else %}mdi:less{% endif %}",
+ "state": (
+ "{{ ((states.sensor.test_template_sensor.state or 0) | int) + 1 }}"
+ ),
+ "icon": (
+ "{% if ((states.sensor.test_template_sensor"
+ ".state or 0) | int) >= 1 %}mdi:greater"
+ "{% else %}mdi:less{% endif %}"
+ ),
},
((ATTR_ICON, "mdi:greater"),),
3,
),
(
{
- "state": "{{ ((states.sensor.test_template_sensor.state or 0) | int) + 1 }}",
- "icon": "{% if ((states.sensor.test_template_sensor.state or 0) | int) > 3 %}mdi:greater{% else %}mdi:less{% endif %}",
- "picture": "{% if ((states.sensor.test_template_sensor.state or 0) | int) >= 1 %}bigpic{% else %}smallpic{% endif %}",
+ "state": (
+ "{{ ((states.sensor.test_template_sensor.state or 0) | int) + 1 }}"
+ ),
+ "icon": (
+ "{% if ((states.sensor.test_template_sensor"
+ ".state or 0) | int) > 3 %}mdi:greater"
+ "{% else %}mdi:less{% endif %}"
+ ),
+ "picture": (
+ "{% if ((states.sensor.test_template_sensor"
+ ".state or 0) | int) >= 1 %}bigpic"
+ "{% else %}smallpic{% endif %}"
+ ),
},
(
(ATTR_ICON, "mdi:less"),
@@ -850,8 +914,16 @@ async def test_self_referencing_sensor_loop(
{
"default_entity_id": TEST_SENSOR.entity_id,
"state": "{{ 1 }}",
- "picture": "{{ ((states.sensor.test_template_sensor.attributes['entity_picture'] or 0) | int) + 1 }}",
- "name": "{{ ((states.sensor.test_template_sensor.attributes['friendly_name'] or 0) | int) + 1 }}",
+ "picture": (
+ "{{ ((states.sensor.test_template_sensor"
+ ".attributes['entity_picture'] or 0)"
+ " | int) + 1 }}"
+ ),
+ "name": (
+ "{{ ((states.sensor.test_template_sensor"
+ ".attributes['friendly_name'] or 0)"
+ " | int) + 1 }}"
+ ),
},
(
(ATTR_ENTITY_PICTURE, "3"),
@@ -893,19 +965,27 @@ async def test_self_referencing_icon_with_no_loop(
hass.states.async_set("sensor.heartworm_avg_64", 10)
hass.states.async_set("sensor.heartworm_avg_57", 10)
- value_template_str = """{% if (states.sensor.heartworm_high_80.state|int >= 10) and (states.sensor.heartworm_low_57.state|int >= 10) %}
- extreme
- {% elif (states.sensor.heartworm_avg_64.state|int >= 30) %}
- high
- {% elif (states.sensor.heartworm_avg_64.state|int >= 14) %}
- moderate
- {% elif (states.sensor.heartworm_avg_64.state|int >= 5) %}
- slight
- {% elif (states.sensor.heartworm_avg_57.state|int >= 5) %}
- marginal
- {% elif (states.sensor.heartworm_avg_57.state|int < 5) %}
- none
- {% endif %}"""
+ value_template_str = (
+ "{% if (states.sensor.heartworm_high_80.state|int >= 10)"
+ " and (states.sensor.heartworm_low_57.state|int >= 10) %}\n"
+ " extreme\n"
+ " {% elif (states.sensor.heartworm_avg_64.state"
+ "|int >= 30) %}\n"
+ " high\n"
+ " {% elif (states.sensor.heartworm_avg_64.state"
+ "|int >= 14) %}\n"
+ " moderate\n"
+ " {% elif (states.sensor.heartworm_avg_64.state"
+ "|int >= 5) %}\n"
+ " slight\n"
+ " {% elif (states.sensor.heartworm_avg_57.state"
+ "|int >= 5) %}\n"
+ " marginal\n"
+ " {% elif (states.sensor.heartworm_avg_57.state"
+ "|int < 5) %}\n"
+ " none\n"
+ " {% endif %}"
+ )
icon_template_str = """{% if is_state('sensor.heartworm_risk',"extreme") %}
mdi:hazard-lights
@@ -1051,7 +1131,9 @@ async def test_trigger_conditional_entity(hass: HomeAssistant) -> None:
"condition": [
{
"condition": "template",
- "value_template": "{{ trigger.event.data.beer / 0 == 'narf' }}",
+ "value_template": (
+ "{{ trigger.event.data.beer / 0 == 'narf' }}"
+ ),
}
],
"sensor": [
@@ -1204,7 +1286,9 @@ async def test_trigger_attribute_order(
"sensor": [
{
"name": "Test Sensor",
- "availability": "{{ trigger and trigger.event.data.beer == 2 }}",
+ "availability": (
+ "{{ trigger and trigger.event.data.beer == 2 }}"
+ ),
"state": "{{ trigger.event.data.beer }}",
"attributes": {
"beer": "{{ trigger.event.data.beer }}",
@@ -1235,13 +1319,16 @@ async def test_trigger_attribute_order(
assert state.attributes["beer"] == 2
assert "no_beer" not in state.attributes
assert (
- "Error rendering attributes.no_beer template for sensor.test_sensor: UndefinedError: 'sad' is undefined"
- in caplog.text
+ "Error rendering attributes.no_beer template for"
+ " sensor.test_sensor: UndefinedError: 'sad' is undefined" in caplog.text
)
assert state.attributes["more_beer"] == 3
assert (
- "Error rendering attributes.all_the_beer template for sensor.test_sensor: ValueError: Template error: int got invalid input 'unknown' when rendering template '{{ this.state | int + more_beer }}' but no default was specified"
- in caplog.text
+ "Error rendering attributes.all_the_beer template for"
+ " sensor.test_sensor: ValueError: Template error: int got"
+ " invalid input 'unknown' when rendering template"
+ " '{{ this.state | int + more_beer }}' but no default was"
+ " specified" in caplog.text
)
hass.bus.async_fire("test_event", {"beer": 2})
@@ -1256,7 +1343,9 @@ async def test_trigger_attribute_order(
assert (
caplog.text.count(
- "Error rendering attributes.no_beer template for sensor.test_sensor: UndefinedError: 'sad' is undefined"
+ "Error rendering attributes.no_beer template for"
+ " sensor.test_sensor: UndefinedError:"
+ " 'sad' is undefined"
)
== 2
)
diff --git a/tests/components/template/test_trigger_entity.py b/tests/components/template/test_trigger_entity.py
index 7b4b9cb4ed0..5a874e2fdb5 100644
--- a/tests/components/template/test_trigger_entity.py
+++ b/tests/components/template/test_trigger_entity.py
@@ -264,7 +264,7 @@ async def test_coordinator_shutdown_unloads_script_and_condition(
async def test_shutdown_stops_script_and_keeps_triggers_subscribed(
hass: HomeAssistant,
) -> None:
- """Test that HA shutdown stops coordinator scripts without unsubscribing triggers."""
+ """Test HA shutdown stops coordinator scripts without unsubscribing."""
assert await async_setup_component(
hass,
"template",
diff --git a/tests/components/template/test_update.py b/tests/components/template/test_update.py
index e926991ef74..44c168a307f 100644
--- a/tests/components/template/test_update.py
+++ b/tests/components/template/test_update.py
@@ -461,7 +461,10 @@ async def test_install_action(hass: HomeAssistant, calls: list[ServiceCall]) ->
),
(
"icon",
- "{% if is_state('sensor.installed_update', 'on') %}mdi:something{% endif %}",
+ (
+ "{% if is_state('sensor.installed_update', 'on') %}"
+ "mdi:something{% endif %}"
+ ),
ATTR_ICON,
"mdi:something",
),
@@ -701,7 +704,10 @@ async def test_update_percent_template(
TEST_INSTALLED_TEMPLATE,
TEST_LATEST_TEMPLATE,
"update_percentage",
- "{% set e = 'sensor.test_update' %}{{ states(e) if e | has_value else None }}",
+ (
+ "{% set e = 'sensor.test_update' %}"
+ "{{ states(e) if e | has_value else None }}"
+ ),
)
],
)
diff --git a/tests/components/template/test_vacuum.py b/tests/components/template/test_vacuum.py
index 8250c7b9aae..bbbb2cd7b8b 100644
--- a/tests/components/template/test_vacuum.py
+++ b/tests/components/template/test_vacuum.py
@@ -1014,7 +1014,10 @@ async def test_not_optimistic(
"unique_id": TEST_VACUUM.entity_id,
"start": [],
**CLEAN_SEGMENTS_ACTION,
- "segments": "{{ [{'id': '1', 'name': 'Livingroom'}, {'id': '2', 'name': 'Kitchen'}] }}",
+ "segments": (
+ "{{ [{'id': '1', 'name': 'Livingroom'},"
+ " {'id': '2', 'name': 'Kitchen'}] }}"
+ ),
},
)
],
@@ -1130,39 +1133,47 @@ async def test_get_segments(
"unique_id": TEST_VACUUM.entity_id,
"segments": "{{ [ {'id': '1'} ] }}",
},
- "expected dictionary with keys id, name and optional group and string values",
+ "expected dictionary with keys id, name and optional"
+ " group and string values",
),
(
{
"unique_id": TEST_VACUUM.entity_id,
"segments": "{{ [ {'name': 'kitchen'} ] }}",
},
- "expected dictionary with keys id, name and optional group and string values",
+ "expected dictionary with keys id, name and optional"
+ " group and string values",
),
(
{
"unique_id": TEST_VACUUM.entity_id,
"segments": "{{ [ {} ] }}",
},
- "expected dictionary with keys id, name and optional group and string values",
+ "expected dictionary with keys id, name and optional"
+ " group and string values",
),
(
{
"unique_id": TEST_VACUUM.entity_id,
- "segments": "{{ [ {'id': '1', 'name': 'Kitchen', 'extra_key': 'value'} ] }}",
+ "segments": (
+ "{{ [ {'id': '1', 'name': 'Kitchen', 'extra_key': 'value'} ] }}"
+ ),
},
- "expected dictionary with keys id, name and optional group and string values",
+ "expected dictionary with keys id, name and optional"
+ " group and string values",
),
(
{"unique_id": TEST_VACUUM.entity_id, "segments": "{{ [[]] }}"},
- "expected dictionary with keys id, name and optional group and string values",
+ "expected dictionary with keys id, name and optional"
+ " group and string values",
),
(
{
"unique_id": TEST_VACUUM.entity_id,
"segments": "{{ [ {'id': '1', 'name': 'Kitchen'}, [] ] }}",
},
- "expected dictionary with keys id, name and optional group and string values",
+ "expected dictionary with keys id, name and optional"
+ " group and string values",
),
],
)
@@ -1197,7 +1208,11 @@ async def test_invalid_segments(
"unique_id": TEST_VACUUM.entity_id,
"start": [],
**CLEAN_SEGMENTS_ACTION,
- "segments": "{{ [ {'id': '1', 'name': 'Kitchen'}, {'id': '2', 'name': states('sensor.test_attribute')}] }}",
+ "segments": (
+ "{{ [ {'id': '1', 'name': 'Kitchen'},"
+ " {'id': '2', 'name':"
+ " states('sensor.test_attribute')}] }}"
+ ),
},
)
],
diff --git a/tests/components/template/test_validators.py b/tests/components/template/test_validators.py
index 8b198871c64..018ebdcdc3a 100644
--- a/tests/components/template/test_validators.py
+++ b/tests/components/template/test_validators.py
@@ -74,11 +74,13 @@ def create_test_entity(hass: HomeAssistant, config: dict) -> TemplateEntity:
[
(
{"default_entity_id": "test.test"},
- "Received invalid test state: {} for entity test.test, expected one of mmmm, beer, is, good",
+ "Received invalid test state: {} for entity"
+ " test.test, expected one of mmmm, beer, is, good",
),
(
{},
- "Received invalid state: {} for entity Test, expected one of mmmm, beer, is, good",
+ "Received invalid state: {} for entity Test,"
+ " expected one of mmmm, beer, is, good",
),
],
)
@@ -152,11 +154,16 @@ async def test_none_on_unknown_and_unavailable(
[
(
{"default_entity_id": "test.test"},
- "Received invalid test state: {} for entity test.test, expected one of mmmm, beer, is, good, 1, true, yes, on, enable, 0, false, no, off, disable",
+ "Received invalid test state: {} for entity"
+ " test.test, expected one of mmmm, beer, is, good,"
+ " 1, true, yes, on, enable, 0, false, no, off,"
+ " disable",
),
(
{},
- "Received invalid state: {} for entity Test, expected one of mmmm, beer, is, good, 1, true, yes, on, enable, 0, false, no, off, disable",
+ "Received invalid state: {} for entity Test,"
+ " expected one of mmmm, beer, is, good, 1, true,"
+ " yes, on, enable, 0, false, no, off, disable",
),
],
)
@@ -210,11 +217,15 @@ async def test_enum_with_on_off(
[
(
{"default_entity_id": "test.test"},
- "Received invalid test state: {} for entity test.test, expected one of mmmm, beer, is, good, 1, true, yes, on, enable",
+ "Received invalid test state: {} for entity"
+ " test.test, expected one of mmmm, beer, is, good,"
+ " 1, true, yes, on, enable",
),
(
{},
- "Received invalid state: {} for entity Test, expected one of mmmm, beer, is, good, 1, true, yes, on, enable",
+ "Received invalid state: {} for entity Test,"
+ " expected one of mmmm, beer, is, good, 1, true,"
+ " yes, on, enable",
),
],
)
@@ -267,11 +278,15 @@ async def test_enum_with_on(
[
(
{"default_entity_id": "test.test"},
- "Received invalid test state: {} for entity test.test, expected one of mmmm, beer, is, good, 0, false, no, off, disable",
+ "Received invalid test state: {} for entity"
+ " test.test, expected one of mmmm, beer, is, good,"
+ " 0, false, no, off, disable",
),
(
{},
- "Received invalid state: {} for entity Test, expected one of mmmm, beer, is, good, 0, false, no, off, disable",
+ "Received invalid state: {} for entity Test,"
+ " expected one of mmmm, beer, is, good, 0, false,"
+ " no, off, disable",
),
],
)
@@ -324,11 +339,15 @@ async def test_enum_with_off(
[
(
{"default_entity_id": "test.test"},
- "Received invalid test state: {} for entity test.test, expected one of 1, true, yes, on, enable, 0, false, no, off, disable",
+ "Received invalid test state: {} for entity"
+ " test.test, expected one of 1, true, yes, on,"
+ " enable, 0, false, no, off, disable",
),
(
{},
- "Received invalid state: {} for entity Test, expected one of 1, true, yes, on, enable, 0, false, no, off, disable",
+ "Received invalid state: {} for entity Test,"
+ " expected one of 1, true, yes, on, enable, 0,"
+ " false, no, off, disable",
),
],
)
@@ -372,11 +391,15 @@ async def test_boolean(
[
(
{"default_entity_id": "test.test"},
- "Received invalid test state: {} for entity test.test, expected one of 1, true, yes, on, enable, 0, false, no, off, disable",
+ "Received invalid test state: {} for entity"
+ " test.test, expected one of 1, true, yes, on,"
+ " enable, 0, false, no, off, disable",
),
(
{},
- "Received invalid state: {} for entity Test, expected one of 1, true, yes, on, enable, 0, false, no, off, disable",
+ "Received invalid state: {} for entity Test,"
+ " expected one of 1, true, yes, on, enable, 0,"
+ " false, no, off, disable",
),
],
)
@@ -421,11 +444,16 @@ async def test_boolean_as_true(
[
(
{"default_entity_id": "test.test"},
- "Received invalid test state: {} for entity test.test, expected one of 1, true, yes, on, enable, 0, false, no, off, disable, something_unique",
+ "Received invalid test state: {} for entity"
+ " test.test, expected one of 1, true, yes, on,"
+ " enable, 0, false, no, off, disable,"
+ " something_unique",
),
(
{},
- "Received invalid state: {} for entity Test, expected one of 1, true, yes, on, enable, 0, false, no, off, disable, something_unique",
+ "Received invalid state: {} for entity Test,"
+ " expected one of 1, true, yes, on, enable, 0,"
+ " false, no, off, disable, something_unique",
),
],
)
@@ -584,11 +612,14 @@ async def test_number_as_int(
[
(
{"default_entity_id": "test.test"},
- "Received invalid test state: {} for entity test.test, expected a number greater than or equal to 0.0",
+ "Received invalid test state: {} for entity"
+ " test.test, expected a number greater than or"
+ " equal to 0.0",
),
(
{},
- "Received invalid state: {} for entity Test, expected a number greater than or equal to 0.0",
+ "Received invalid state: {} for entity Test,"
+ " expected a number greater than or equal to 0.0",
),
],
)
@@ -642,11 +673,14 @@ async def test_number_with_minimum(
[
(
{"default_entity_id": "test.test"},
- "Received invalid test state: {} for entity test.test, expected a number less than or equal to 0.0",
+ "Received invalid test state: {} for entity"
+ " test.test, expected a number less than or equal"
+ " to 0.0",
),
(
{},
- "Received invalid state: {} for entity Test, expected a number less than or equal to 0.0",
+ "Received invalid state: {} for entity Test,"
+ " expected a number less than or equal to 0.0",
),
],
)
@@ -696,11 +730,14 @@ async def test_number_with_maximum(
[
(
{"default_entity_id": "test.test"},
- "Received invalid test state: {} for entity test.test, expected a number between 0.0 and 100.0",
+ "Received invalid test state: {} for entity"
+ " test.test, expected a number between 0.0 and"
+ " 100.0",
),
(
{},
- "Received invalid state: {} for entity Test, expected a number between 0.0 and 100.0",
+ "Received invalid state: {} for entity Test,"
+ " expected a number between 0.0 and 100.0",
),
],
)
@@ -748,7 +785,8 @@ async def test_number_in_range(
[
(
{"default_entity_id": "test.test"},
- "Received invalid test state: {} for entity test.test, expected a list of strings",
+ "Received invalid test state: {} for entity"
+ " test.test, expected a list of strings",
),
(
{},
@@ -807,7 +845,8 @@ async def test_list_of_strings_none_on_empty(
[
(
{"default_entity_id": "test.test"},
- "Received invalid test state: {} for entity test.test, expected beer, is, GOOD",
+ "Received invalid test state: {} for entity"
+ " test.test, expected beer, is, GOOD",
),
(
{},
@@ -859,11 +898,13 @@ async def test_item_in_list(
[
(
{"default_entity_id": "test.test"},
- "Received invalid test state: {} for entity test.test, expected one of beer, is, GOOD",
+ "Received invalid test state: {} for entity"
+ " test.test, expected one of beer, is, GOOD",
),
(
{},
- "Received invalid state: {} for entity Test, expected one of beer, is, GOOD",
+ "Received invalid state: {} for entity Test,"
+ " expected one of beer, is, GOOD",
),
],
)
diff --git a/tests/components/template/test_weather.py b/tests/components/template/test_weather.py
index 0cdf7714e11..81f5d3ad335 100644
--- a/tests/components/template/test_weather.py
+++ b/tests/components/template/test_weather.py
@@ -147,7 +147,9 @@ async def test_template_state_exception(hass: HomeAssistant) -> None:
(
ConfigurationStyle.MODERN,
{
- "apparent_temperature_template": "{{ states('sensor.apparent_temperature') }}",
+ "apparent_temperature_template": (
+ "{{ states('sensor.apparent_temperature') }}"
+ ),
"attribution_template": "{{ states('sensor.attribution') }}",
"cloud_coverage_template": "{{ states('sensor.cloud_coverage') }}",
"condition_template": "{{ states('sensor.condition') }}",
@@ -167,7 +169,9 @@ async def test_template_state_exception(hass: HomeAssistant) -> None:
(
ConfigurationStyle.TRIGGER,
{
- "apparent_temperature_template": "{{ states('sensor.apparent_temperature') }}",
+ "apparent_temperature_template": (
+ "{{ states('sensor.apparent_temperature') }}"
+ ),
"attribution_template": "{{ states('sensor.attribution') }}",
"cloud_coverage_template": "{{ states('sensor.cloud_coverage') }}",
"condition_template": "{{ states('sensor.condition') }}",
@@ -264,15 +268,23 @@ async def test_template_state_text(hass: HomeAssistant) -> None:
"config",
[
{
- "forecast_daily_template": "{{ state_attr('sensor.forecast', 'forecast') }}",
- "forecast_hourly_template": "{{ state_attr('sensor.forecast', 'forecast') }}",
- "forecast_twice_daily_template": "{{ state_attr('sensor.forecast_twice_daily', 'forecast') }}",
+ "forecast_daily_template": (
+ "{{ state_attr('sensor.forecast', 'forecast') }}"
+ ),
+ "forecast_hourly_template": (
+ "{{ state_attr('sensor.forecast', 'forecast') }}"
+ ),
+ "forecast_twice_daily_template": (
+ "{{ state_attr('sensor.forecast_twice_daily', 'forecast') }}"
+ ),
**TEST_LEGACY_REQUIRED,
},
{
"forecast_daily": "{{ state_attr('sensor.forecast', 'forecast') }}",
"forecast_hourly": "{{ state_attr('sensor.forecast', 'forecast') }}",
- "forecast_twice_daily": "{{ state_attr('sensor.forecast_twice_daily', 'forecast') }}",
+ "forecast_twice_daily": (
+ "{{ state_attr('sensor.forecast_twice_daily', 'forecast') }}"
+ ),
**TEST_MODERN_REQUIRED,
},
],
@@ -365,36 +377,60 @@ async def test_forecasts(hass: HomeAssistant, snapshot: SnapshotAssertion) -> No
(
ConfigurationStyle.MODERN,
{
- "forecast_daily_template": "{{ state_attr('sensor.forecast_daily', 'forecast') }}",
- "forecast_hourly_template": "{{ state_attr('sensor.forecast_hourly', 'forecast') }}",
- "forecast_twice_daily_template": "{{ state_attr('sensor.forecast_twice_daily', 'forecast') }}",
+ "forecast_daily_template": (
+ "{{ state_attr('sensor.forecast_daily', 'forecast') }}"
+ ),
+ "forecast_hourly_template": (
+ "{{ state_attr('sensor.forecast_hourly', 'forecast') }}"
+ ),
+ "forecast_twice_daily_template": (
+ "{{ state_attr('sensor.forecast_twice_daily', 'forecast') }}"
+ ),
**TEST_LEGACY_REQUIRED,
},
),
(
ConfigurationStyle.TRIGGER,
{
- "forecast_daily_template": "{{ state_attr('sensor.forecast_daily', 'forecast') }}",
- "forecast_hourly_template": "{{ state_attr('sensor.forecast_hourly', 'forecast') }}",
- "forecast_twice_daily_template": "{{ state_attr('sensor.forecast_twice_daily', 'forecast') }}",
+ "forecast_daily_template": (
+ "{{ state_attr('sensor.forecast_daily', 'forecast') }}"
+ ),
+ "forecast_hourly_template": (
+ "{{ state_attr('sensor.forecast_hourly', 'forecast') }}"
+ ),
+ "forecast_twice_daily_template": (
+ "{{ state_attr('sensor.forecast_twice_daily', 'forecast') }}"
+ ),
**TEST_LEGACY_REQUIRED,
},
),
(
ConfigurationStyle.MODERN,
{
- "forecast_daily": "{{ state_attr('sensor.forecast_daily', 'forecast') }}",
- "forecast_hourly": "{{ state_attr('sensor.forecast_hourly', 'forecast') }}",
- "forecast_twice_daily": "{{ state_attr('sensor.forecast_twice_daily', 'forecast') }}",
+ "forecast_daily": (
+ "{{ state_attr('sensor.forecast_daily', 'forecast') }}"
+ ),
+ "forecast_hourly": (
+ "{{ state_attr('sensor.forecast_hourly', 'forecast') }}"
+ ),
+ "forecast_twice_daily": (
+ "{{ state_attr('sensor.forecast_twice_daily', 'forecast') }}"
+ ),
**TEST_MODERN_REQUIRED,
},
),
(
ConfigurationStyle.TRIGGER,
{
- "forecast_daily": "{{ state_attr('sensor.forecast_daily', 'forecast') }}",
- "forecast_hourly": "{{ state_attr('sensor.forecast_hourly', 'forecast') }}",
- "forecast_twice_daily": "{{ state_attr('sensor.forecast_twice_daily', 'forecast') }}",
+ "forecast_daily": (
+ "{{ state_attr('sensor.forecast_daily', 'forecast') }}"
+ ),
+ "forecast_hourly": (
+ "{{ state_attr('sensor.forecast_hourly', 'forecast') }}"
+ ),
+ "forecast_twice_daily": (
+ "{{ state_attr('sensor.forecast_twice_daily', 'forecast') }}"
+ ),
**TEST_MODERN_REQUIRED,
},
),
@@ -507,36 +543,60 @@ async def test_forecasts_invalid(
(
ConfigurationStyle.MODERN,
{
- "forecast_daily_template": "{{ state_attr('sensor.forecast_daily', 'forecast') }}",
- "forecast_hourly_template": "{{ state_attr('sensor.forecast_hourly', 'forecast') }}",
- "forecast_twice_daily_template": "{{ state_attr('sensor.forecast_twice_daily', 'forecast') }}",
+ "forecast_daily_template": (
+ "{{ state_attr('sensor.forecast_daily', 'forecast') }}"
+ ),
+ "forecast_hourly_template": (
+ "{{ state_attr('sensor.forecast_hourly', 'forecast') }}"
+ ),
+ "forecast_twice_daily_template": (
+ "{{ state_attr('sensor.forecast_twice_daily', 'forecast') }}"
+ ),
**TEST_LEGACY_REQUIRED,
},
),
(
ConfigurationStyle.TRIGGER,
{
- "forecast_daily_template": "{{ state_attr('sensor.forecast_daily', 'forecast') }}",
- "forecast_hourly_template": "{{ state_attr('sensor.forecast_hourly', 'forecast') }}",
- "forecast_twice_daily_template": "{{ state_attr('sensor.forecast_twice_daily', 'forecast') }}",
+ "forecast_daily_template": (
+ "{{ state_attr('sensor.forecast_daily', 'forecast') }}"
+ ),
+ "forecast_hourly_template": (
+ "{{ state_attr('sensor.forecast_hourly', 'forecast') }}"
+ ),
+ "forecast_twice_daily_template": (
+ "{{ state_attr('sensor.forecast_twice_daily', 'forecast') }}"
+ ),
**TEST_LEGACY_REQUIRED,
},
),
(
ConfigurationStyle.MODERN,
{
- "forecast_daily": "{{ state_attr('sensor.forecast_daily', 'forecast') }}",
- "forecast_hourly": "{{ state_attr('sensor.forecast_hourly', 'forecast') }}",
- "forecast_twice_daily": "{{ state_attr('sensor.forecast_twice_daily', 'forecast') }}",
+ "forecast_daily": (
+ "{{ state_attr('sensor.forecast_daily', 'forecast') }}"
+ ),
+ "forecast_hourly": (
+ "{{ state_attr('sensor.forecast_hourly', 'forecast') }}"
+ ),
+ "forecast_twice_daily": (
+ "{{ state_attr('sensor.forecast_twice_daily', 'forecast') }}"
+ ),
**TEST_MODERN_REQUIRED,
},
),
(
ConfigurationStyle.TRIGGER,
{
- "forecast_daily": "{{ state_attr('sensor.forecast_daily', 'forecast') }}",
- "forecast_hourly": "{{ state_attr('sensor.forecast_hourly', 'forecast') }}",
- "forecast_twice_daily": "{{ state_attr('sensor.forecast_twice_daily', 'forecast') }}",
+ "forecast_daily": (
+ "{{ state_attr('sensor.forecast_daily', 'forecast') }}"
+ ),
+ "forecast_hourly": (
+ "{{ state_attr('sensor.forecast_hourly', 'forecast') }}"
+ ),
+ "forecast_twice_daily": (
+ "{{ state_attr('sensor.forecast_twice_daily', 'forecast') }}"
+ ),
**TEST_MODERN_REQUIRED,
},
),
@@ -635,7 +695,9 @@ SAVED_EXTRA_DATA_WITH_FUTURE_KEY = {
"weather": {
"name": "test",
"condition_template": "{{ trigger.event.data.condition }}",
- "temperature_template": "{{ trigger.event.data.temperature | float }}",
+ "temperature_template": (
+ "{{ trigger.event.data.temperature | float }}"
+ ),
"temperature_unit": "°C",
"humidity_template": "{{ trigger.event.data.humidity | float }}",
},
@@ -712,7 +774,9 @@ async def test_trigger_entity_restore_state(
"action": [
{
"variables": {
- "my_variable": "{{ trigger.event.data.temperature + 1 }}"
+ "my_variable": (
+ "{{ trigger.event.data.temperature + 1 }}"
+ )
},
},
],
@@ -760,7 +824,9 @@ async def test_restore_weather_save_state(
"weather": {
"name": "test",
"condition_template": "{{ trigger.event.data.condition }}",
- "temperature_template": "{{ trigger.event.data.temperature | float }}",
+ "temperature_template": (
+ "{{ trigger.event.data.temperature | float }}"
+ ),
"temperature_unit": "°C",
"humidity_template": "{{ trigger.event.data.humidity | float }}",
},
@@ -853,7 +919,9 @@ async def test_trigger_entity_restore_state_fail(
"weather": {
"name": "test",
"condition_template": "{{ trigger.event.data.condition }}",
- "temperature_template": "{{ trigger.event.data.temperature | float }}",
+ "temperature_template": (
+ "{{ trigger.event.data.temperature | float }}"
+ ),
"temperature_unit": "°C",
"humidity_template": "{{ trigger.event.data.humidity | float }}",
},
@@ -879,7 +947,10 @@ async def test_trigger_entity_restore_state_fail(
[
(
{
- CONF_ICON: "{% if states.weather.test_state.state == 'sunny' %}mdi:check{% endif %}",
+ CONF_ICON: (
+ "{% if states.weather.test_state.state =="
+ " 'sunny' %}mdi:check{% endif %}"
+ ),
**TEST_LEGACY_REQUIRED,
},
ATTR_ICON,
@@ -887,7 +958,10 @@ async def test_trigger_entity_restore_state_fail(
),
(
{
- CONF_PICTURE: "{% if states.weather.test_state.state == 'sunny' %}check.jpg{% endif %}",
+ CONF_PICTURE: (
+ "{% if states.weather.test_state.state =="
+ " 'sunny' %}check.jpg{% endif %}"
+ ),
**TEST_LEGACY_REQUIRED,
},
ATTR_ENTITY_PICTURE,
diff --git a/tests/components/tesla_fleet/test_climate.py b/tests/components/tesla_fleet/test_climate.py
index 2746169f5cb..1c6f38da06e 100644
--- a/tests/components/tesla_fleet/test_climate.py
+++ b/tests/components/tesla_fleet/test_climate.py
@@ -446,7 +446,11 @@ async def test_climate_notemp(
with pytest.raises(
ServiceValidationError,
- match="Set temperature action was used with the 'Lower/Upper target temperature' parameter but the entity does not support it",
+ match=(
+ "Set temperature action was used with the"
+ " 'Lower/Upper target temperature' parameter but the"
+ " entity does not support it"
+ ),
):
await hass.services.async_call(
CLIMATE_DOMAIN,
diff --git a/tests/components/tesla_fleet/test_config_flow.py b/tests/components/tesla_fleet/test_config_flow.py
index 9e8c9542c13..aca702a8903 100644
--- a/tests/components/tesla_fleet/test_config_flow.py
+++ b/tests/components/tesla_fleet/test_config_flow.py
@@ -80,9 +80,14 @@ def mock_private_key():
public_key = Mock()
private_key.public_key.return_value = public_key
public_key.public_bytes.side_effect = [
- b"-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA\n-----END PUBLIC KEY-----",
+ b"-----BEGIN PUBLIC KEY-----\n"
+ b"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA\n"
+ b"-----END PUBLIC KEY-----",
bytes.fromhex(
- "0404112233445566778899aabbccddeeff112233445566778899aabbccddeeff112233445566778899aabbccddeeff112233445566778899aabbccddeeff1122"
+ "0404112233445566778899aabbccddeeff"
+ "112233445566778899aabbccddeeff"
+ "112233445566778899aabbccddeeff"
+ "112233445566778899aabbccddeeff1122"
),
]
return private_key
@@ -171,7 +176,12 @@ async def test_partner_login_partial_failure(
},
)
- public_key = "0404112233445566778899aabbccddeeff112233445566778899aabbccddeeff112233445566778899aabbccddeeff112233445566778899aabbccddeeff1122"
+ public_key = (
+ "0404112233445566778899aabbccddeeff"
+ "112233445566778899aabbccddeeff"
+ "112233445566778899aabbccddeeff"
+ "112233445566778899aabbccddeeff1122"
+ )
mock_api_na = AsyncMock()
mock_api_na.private_key = mock_private_key
@@ -265,10 +275,20 @@ async def test_full_flow_with_domain_registration(
mock_api.private_key = mock_private_key
mock_api.get_private_key = AsyncMock()
mock_api.partner_login = AsyncMock()
- mock_api.public_uncompressed_point = "0404112233445566778899aabbccddeeff112233445566778899aabbccddeeff112233445566778899aabbccddeeff112233445566778899aabbccddeeff1122"
+ mock_api.public_uncompressed_point = (
+ "0404112233445566778899aabbccddeeff"
+ "112233445566778899aabbccddeeff"
+ "112233445566778899aabbccddeeff"
+ "112233445566778899aabbccddeeff1122"
+ )
mock_api.partner.register.return_value = {
"response": {
- "public_key": "0404112233445566778899aabbccddeeff112233445566778899aabbccddeeff112233445566778899aabbccddeeff112233445566778899aabbccddeeff1122"
+ "public_key": (
+ "0404112233445566778899aabbccddeeff"
+ "112233445566778899aabbccddeeff"
+ "112233445566778899aabbccddeeff"
+ "112233445566778899aabbccddeeff1122"
+ )
}
}
mock_api_class.return_value = mock_api
@@ -278,7 +298,8 @@ async def test_full_flow_with_domain_registration(
assert result["type"] is FlowResultType.FORM
assert result["step_id"] == "domain_input"
- # Enter domain - this should automatically register and go to registration_complete
+ # Enter domain - this should automatically register and go to
+ # registration_complete
result = await hass.config_entries.flow.async_configure(
result["flow_id"], {CONF_DOMAIN: "example.com"}
)
@@ -351,11 +372,22 @@ async def test_domain_input_invalid_domain(
assert result["step_id"] == "domain_input"
assert result["errors"] == {CONF_DOMAIN: "invalid_domain"}
- # Enter valid domain - this should automatically register and go to registration_complete
- mock_api.public_uncompressed_point = "0404112233445566778899aabbccddeeff112233445566778899aabbccddeeff112233445566778899aabbccddeeff112233445566778899aabbccddeeff1122"
+ # Enter valid domain - this should automatically register
+ # and go to registration_complete
+ mock_api.public_uncompressed_point = (
+ "0404112233445566778899aabbccddeeff"
+ "112233445566778899aabbccddeeff"
+ "112233445566778899aabbccddeeff"
+ "112233445566778899aabbccddeeff1122"
+ )
mock_api.partner.register.return_value = {
"response": {
- "public_key": "0404112233445566778899aabbccddeeff112233445566778899aabbccddeeff112233445566778899aabbccddeeff112233445566778899aabbccddeeff1122"
+ "public_key": (
+ "0404112233445566778899aabbccddeeff"
+ "112233445566778899aabbccddeeff"
+ "112233445566778899aabbccddeeff"
+ "112233445566778899aabbccddeeff1122"
+ )
}
}
result = await hass.config_entries.flow.async_configure(
@@ -483,7 +515,8 @@ async def test_domain_registration_precondition_failed(
# Complete OAuth
result = await hass.config_entries.flow.async_configure(result["flow_id"])
- # Enter domain - this should go to domain_registration and then fail back to domain_input
+ # Enter domain - this should go to domain_registration
+ # and then fail back to domain_input
result = await hass.config_entries.flow.async_configure(
result["flow_id"], {CONF_DOMAIN: "example.com"}
)
@@ -646,7 +679,12 @@ async def test_domain_registration_partial_failure(
},
)
- public_key = "0404112233445566778899aabbccddeeff112233445566778899aabbccddeeff112233445566778899aabbccddeeff112233445566778899aabbccddeeff1122"
+ public_key = (
+ "0404112233445566778899aabbccddeeff"
+ "112233445566778899aabbccddeeff"
+ "112233445566778899aabbccddeeff"
+ "112233445566778899aabbccddeeff1122"
+ )
# Create two separate mocks for NA and EU
mock_api_na = AsyncMock()
diff --git a/tests/components/tesla_wall_connector/conftest.py b/tests/components/tesla_wall_connector/conftest.py
index 10685826d5e..b69ebfef6a9 100644
--- a/tests/components/tesla_wall_connector/conftest.py
+++ b/tests/components/tesla_wall_connector/conftest.py
@@ -115,7 +115,7 @@ def get_lifetime_mock() -> Lifetime:
@dataclass
class EntityAndExpectedValues:
- """Class for keeping entity id along with expected value for first and second data updates."""
+ """Class for keeping entity id along with expected update values."""
entity_id: str
first_value: Any
@@ -142,7 +142,8 @@ async def _test_sensors(
state = hass.states.get(entity.entity_id)
assert state, f"Unable to get state of {entity.entity_id}"
assert state.state == entity.first_value, (
- f"First update: {entity.entity_id} is expected to have state {entity.first_value} but has {state.state}"
+ f"First update: {entity.entity_id} is expected to have"
+ f" state {entity.first_value} but has {state.state}"
)
# Simulate second data update
@@ -165,5 +166,6 @@ async def _test_sensors(
for entity in entities_and_expected_values:
state = hass.states.get(entity.entity_id)
assert state.state == entity.second_value, (
- f"Second update: {entity.entity_id} is expected to have state {entity.second_value} but has {state.state}"
+ f"Second update: {entity.entity_id} is expected to have"
+ f" state {entity.second_value} but has {state.state}"
)
diff --git a/tests/components/teslemetry/test_calendar.py b/tests/components/teslemetry/test_calendar.py
index c0469c1b8c9..f740e102a10 100644
--- a/tests/components/teslemetry/test_calendar.py
+++ b/tests/components/teslemetry/test_calendar.py
@@ -344,7 +344,7 @@ async def test_calendar_midnight_crossing_local_start(
freezer: FrozenDateTimeFactory,
mock_legacy: AsyncMock,
) -> None:
- """Test async_get_events includes overnight period when query starts at local midnight."""
+ """Test async_get_events includes overnight period at local midnight."""
tz = dt_util.get_default_time_zone()
freezer.move_to(datetime(2024, 1, 1, 10, 0, 0, tzinfo=tz))
diff --git a/tests/components/teslemetry/test_climate.py b/tests/components/teslemetry/test_climate.py
index 632247c38f8..c7640d99104 100644
--- a/tests/components/teslemetry/test_climate.py
+++ b/tests/components/teslemetry/test_climate.py
@@ -326,7 +326,9 @@ async def test_select_streaming(
Signal.RIGHT_HAND_DRIVE: True,
Signal.HVAC_LEFT_TEMPERATURE_REQUEST: 22,
Signal.HVAC_RIGHT_TEMPERATURE_REQUEST: 21,
- Signal.CABIN_OVERHEAT_PROTECTION_MODE: "CabinOverheatProtectionModeStateOn",
+ Signal.CABIN_OVERHEAT_PROTECTION_MODE: (
+ "CabinOverheatProtectionModeStateOn"
+ ),
Signal.CABIN_OVERHEAT_PROTECTION_TEMPERATURE_LIMIT: 35,
},
"createdAt": "2024-10-04T10:45:17.537Z",
diff --git a/tests/components/teslemetry/test_init.py b/tests/components/teslemetry/test_init.py
index 41358f09864..63ea2be325b 100644
--- a/tests/components/teslemetry/test_init.py
+++ b/tests/components/teslemetry/test_init.py
@@ -781,7 +781,7 @@ async def test_vehicle_polling_version_update(
mock_legacy: AsyncMock,
freezer: FrozenDateTimeFactory,
) -> None:
- """Test vehicle sw_version is updated when polling coordinator receives new version."""
+ """Test vehicle sw_version updates when polling coordinator refreshes."""
entry = await setup_platform(hass)
assert entry.state is ConfigEntryState.LOADED
@@ -812,7 +812,7 @@ async def test_energy_site_version_update(
mock_site_info: AsyncMock,
freezer: FrozenDateTimeFactory,
) -> None:
- """Test energy site sw_version is updated when info coordinator receives new version."""
+ """Test energy site sw_version updates when info coordinator refreshes."""
entry = await setup_platform(hass)
assert entry.state is ConfigEntryState.LOADED
diff --git a/tests/components/teslemetry/test_select.py b/tests/components/teslemetry/test_select.py
index 1282276c871..11f826158f6 100644
--- a/tests/components/teslemetry/test_select.py
+++ b/tests/components/teslemetry/test_select.py
@@ -239,7 +239,8 @@ async def test_export_rule_restore(
},
EnergyExportMode.NEVER.value,
),
- # Path 3: In VPP, Export enabled but state shows disabled (current_option is NEVER)
+ # Path 3: In VPP, Export enabled but state shows disabled
+ # (current_option is NEVER)
(
{
"customer_preferred_export_rule": "never",
diff --git a/tests/components/teslemetry/test_services.py b/tests/components/teslemetry/test_services.py
index c2a7726146d..6eb22c3686d 100644
--- a/tests/components/teslemetry/test_services.py
+++ b/tests/components/teslemetry/test_services.py
@@ -389,7 +389,8 @@ async def test_service_validation_errors(
)
assert exc_info.value.translation_key == "set_scheduled_charging_time"
- # Test set_scheduled_departure validation error (preconditioning_enabled=True but no departure_time)
+ # Test set_scheduled_departure validation error
+ # (preconditioning_enabled=True but no departure_time)
with pytest.raises(ServiceValidationError) as exc_info:
await hass.services.async_call(
DOMAIN,
@@ -402,7 +403,8 @@ async def test_service_validation_errors(
)
assert exc_info.value.translation_key == "set_scheduled_departure_preconditioning"
- # Test set_scheduled_departure validation error (off_peak_charging_enabled=True but no end_off_peak_time)
+ # Test set_scheduled_departure validation error
+ # (off_peak_charging_enabled=True but no end_off_peak_time)
with pytest.raises(ServiceValidationError) as exc_info:
await hass.services.async_call(
DOMAIN,
diff --git a/tests/components/tessie/test_coordinator.py b/tests/components/tessie/test_coordinator.py
index 271d2f489fc..58186e7ae9f 100644
--- a/tests/components/tessie/test_coordinator.py
+++ b/tests/components/tessie/test_coordinator.py
@@ -215,7 +215,7 @@ async def test_coordinator_energy_history_invalid_data(
async def test_coordinator_energy_history_cold_start_invalid_data(
hass: HomeAssistant, mock_energy_history, freezer: FrozenDateTimeFactory
) -> None:
- """Tests cold-start fallback when the very first energy history fetch has invalid data."""
+ """Tests cold-start fallback when first energy history fetch has invalid data."""
mock_energy_history.side_effect = lambda *a, **kw: {"response": {}}
entry = await setup_platform(hass, [Platform.SENSOR])
diff --git a/tests/components/text/test_trigger.py b/tests/components/text/test_trigger.py
index 26aa626e73a..6c50c7866ef 100644
--- a/tests/components/text/test_trigger.py
+++ b/tests/components/text/test_trigger.py
@@ -219,7 +219,7 @@ async def test_input_text_state_trigger(
trigger: str,
states: list[BasicTriggerStateDescription],
) -> None:
- """Test that the `text.changed` trigger fires when any input_text entity's state changes."""
+ """Test text.changed trigger fires on any input_text state change."""
calls: list[str] = []
other_entity_ids = set(target_input_texts["included_entities"]) - {entity_id}
diff --git a/tests/components/tibber/conftest.py b/tests/components/tibber/conftest.py
index ae19505e107..7304803dc74 100644
--- a/tests/components/tibber/conftest.py
+++ b/tests/components/tibber/conftest.py
@@ -59,7 +59,8 @@ def create_tibber_device(
charging_status: Charging status (for binary sensors).
device_status: Device on/off status (for binary sensors).
is_online: Device online status (for binary sensors).
- sensor_values: Dictionary mapping sensor IDs to their values for additional sensors.
+ sensor_values: Dictionary mapping sensor IDs to their values
+ for additional sensors.
"""
capabilities = []
diff --git a/tests/components/tibber/test_sensor.py b/tests/components/tibber/test_sensor.py
index ef919cede6f..6317c48a47b 100644
--- a/tests/components/tibber/test_sensor.py
+++ b/tests/components/tibber/test_sensor.py
@@ -170,7 +170,7 @@ async def test_new_data_api_sensors_with_disabled_by_default(
setup_credentials: None,
entity_registry: er.EntityRegistry,
) -> None:
- """Test that sensors with entity_registry_enabled_default=False are disabled by default."""
+ """Test that sensors with entity_registry_enabled_default=False are disabled."""
sensor_values = {
"cellular.rssi": -75.0,
"energyFlow.hour.battery.source.grid": 500.0,
diff --git a/tests/components/timer/test_init.py b/tests/components/timer/test_init.py
index ad417df43f7..f45fc698132 100644
--- a/tests/components/timer/test_init.py
+++ b/tests/components/timer/test_init.py
@@ -941,7 +941,7 @@ async def test_state_changed_when_timer_restarted(hass: HomeAssistant) -> None:
async def test_last_transition_after_restarted_timer_expires(
hass: HomeAssistant, freezer: FrozenDateTimeFactory
) -> None:
- """Test that last_transition changes from restarted to finished when timer expires."""
+ """Test last_transition changes from restarted to finished on expiry."""
hass.set_state(CoreState.starting)
await async_setup_component(hass, DOMAIN, {DOMAIN: {"test1": {CONF_DURATION: 10}}})
@@ -1366,7 +1366,7 @@ async def test_restore_active_resume(
async def test_restore_active_finished_outside_grace(
hass: HomeAssistant, last_transition: str | None
) -> None:
- """Test entity restore logic: timer is active, ended while Home Assistant was stopped."""
+ """Test entity restore: timer active, ended while HA was stopped."""
events = async_capture_events(hass, EVENT_TIMER_FINISHED)
assert not events
utc_now = utcnow()
diff --git a/tests/components/timer/test_trigger.py b/tests/components/timer/test_trigger.py
index d8d09460959..869842a18f6 100644
--- a/tests/components/timer/test_trigger.py
+++ b/tests/components/timer/test_trigger.py
@@ -144,7 +144,7 @@ async def test_timer_trigger_behavior_any(
trigger_options: dict[str, Any],
states: list[TriggerStateDescription],
) -> None:
- """Test that the timer trigger fires when any timer's last_transition changes to a specific value."""
+ """Test timer trigger fires on any timer last_transition change."""
await assert_trigger_behavior_any(
hass,
target_entities=target_timers,
@@ -202,7 +202,7 @@ async def test_timer_trigger_behavior_first(
trigger_options: dict[str, Any],
states: list[TriggerStateDescription],
) -> None:
- """Test that the timer trigger fires when the first timer's last_transition changes to a specific value."""
+ """Test timer trigger fires on first timer last_transition change."""
await assert_trigger_behavior_first(
hass,
target_entities=target_timers,
@@ -260,7 +260,7 @@ async def test_timer_trigger_behavior_last(
trigger_options: dict[str, Any],
states: list[TriggerStateDescription],
) -> None:
- """Test that the timer trigger fires when the last timer's last_transition changes to a specific value."""
+ """Test timer trigger fires on last timer last_transition change."""
await assert_trigger_behavior_last(
hass,
target_entities=target_timers,
@@ -388,7 +388,7 @@ async def test_time_remaining_trigger_paused_before_threshold(
hass: HomeAssistant,
freezer: FrozenDateTimeFactory,
) -> None:
- """Test time_remaining trigger does not fire when timer is paused before threshold."""
+ """Test time_remaining trigger does not fire when timer is paused."""
now = dt_util.utcnow()
calls: list[dict[str, Any]] = []
@@ -427,7 +427,7 @@ async def test_time_remaining_trigger_cancelled_before_threshold(
hass: HomeAssistant,
freezer: FrozenDateTimeFactory,
) -> None:
- """Test time_remaining trigger does not fire when timer is cancelled before threshold."""
+ """Test time_remaining trigger does not fire when timer is cancelled."""
now = dt_util.utcnow()
calls: list[dict[str, Any]] = []
@@ -516,7 +516,7 @@ async def test_time_remaining_trigger_short_timer(
hass: HomeAssistant,
freezer: FrozenDateTimeFactory,
) -> None:
- """Test time_remaining trigger does not fire when timer duration is shorter than remaining threshold."""
+ """Test time_remaining trigger skips when duration < threshold."""
now = dt_util.utcnow()
calls: list[dict[str, Any]] = []
@@ -585,7 +585,7 @@ async def test_time_remaining_trigger_already_active_past_threshold_at_attach(
hass: HomeAssistant,
freezer: FrozenDateTimeFactory,
) -> None:
- """Test trigger does not schedule for timers already past the fire point at attach."""
+ """Test trigger ignores timers already past the fire point at attach."""
now = dt_util.utcnow()
calls: list[dict[str, Any]] = []
diff --git a/tests/components/tod/test_binary_sensor.py b/tests/components/tod/test_binary_sensor.py
index 8b9a81d7542..8c39305381c 100644
--- a/tests/components/tod/test_binary_sensor.py
+++ b/tests/components/tod/test_binary_sensor.py
@@ -150,7 +150,7 @@ async def test_midnight_turnover_before_midnight_outside_period(
@pytest.mark.freeze_time("2019-01-10 10:00:00-08:00")
async def test_after_happens_tomorrow(hass: HomeAssistant) -> None:
- """Test when both before and after are in the future, and after is later than before."""
+ """Test when before and after are in the future, after is later than before."""
config = {
"binary_sensor": [
{"platform": "tod", "name": "Night", "after": "23:00", "before": "12:00"}
@@ -760,7 +760,8 @@ async def test_dst5(
]
}
# Test DST #5:
- # Test the case where the end time does not exist (roll out to the next available time)
+ # Test case where end time does not exist
+ # (roll out to the next available time)
# First test before the sensor is turned on
entity_id = "binary_sensor.day"
freezer.move_to(test_time1)
@@ -774,7 +775,8 @@ async def test_dst5(
assert state.attributes["next_update"] == "2019-03-31T01:50:00+01:00"
assert state.state == STATE_OFF
- # Seconds, test state when sensor is ON but end time has rolled out to next available time.
+ # Second, test state when sensor is ON but end time has rolled
+ # out to next available time.
freezer.move_to(test_time2)
async_fire_time_changed(hass, dt_util.utcnow())
await hass.async_block_till_done()
@@ -801,7 +803,8 @@ async def test_dst6(
]
}
# Test DST #6:
- # Test the case where the end time does not exist (roll out to the next available time)
+ # Test case where end time does not exist
+ # (roll out to the next available time)
# First test before the sensor is turned on
entity_id = "binary_sensor.day"
freezer.move_to(test_time1)
@@ -815,7 +818,8 @@ async def test_dst6(
assert state.attributes["next_update"] == "2019-03-31T03:00:00+02:00"
assert state.state == STATE_OFF
- # Seconds, test state when sensor is ON but end time has rolled out to next available time.
+ # Second, test state when sensor is ON but end time has rolled
+ # out to next available time.
freezer.move_to(test_time2)
async_fire_time_changed(hass, dt_util.utcnow())
await hass.async_block_till_done()
diff --git a/tests/components/todo/test_condition.py b/tests/components/todo/test_condition.py
index a4fc6a973c6..d7d60ac3348 100644
--- a/tests/components/todo/test_condition.py
+++ b/tests/components/todo/test_condition.py
@@ -180,7 +180,7 @@ def parametrize_incomplete_condition_states_any(
def parametrize_incomplete_condition_states_all(
condition: str,
) -> list[tuple[str, dict[str, Any], list[ConditionStateDescription]]]:
- """Parametrize above/below threshold test cases for incomplete conditions with 'all' behavior."""
+ """Parametrize above/below threshold cases for incomplete 'all' conditions."""
return [
*parametrize_condition_states_all(
condition=condition,
diff --git a/tests/components/todo/test_trigger.py b/tests/components/todo/test_trigger.py
index bbbcdb08686..836fe1d7fb1 100644
--- a/tests/components/todo/test_trigger.py
+++ b/tests/components/todo/test_trigger.py
@@ -522,7 +522,7 @@ async def test_entity_rejoining_label_does_not_fire_trigger(
entity_registry: er.EntityRegistry,
label_registry: lr.LabelRegistry,
) -> None:
- """Test removing and re-adding an entity to a target does not fire stale triggers."""
+ """Test removing and re-adding entity to target does not fire stale triggers."""
label_both = label_registry.async_get_label_by_name("label_both_lists")
assert label_both is not None
label_both_id = label_both.label_id
diff --git a/tests/components/todoist/test_calendar.py b/tests/components/todoist/test_calendar.py
index 71f1c79e021..07250e00180 100644
--- a/tests/components/todoist/test_calendar.py
+++ b/tests/components/todoist/test_calendar.py
@@ -60,7 +60,11 @@ async def set_time_zone(hass: HomeAssistant):
def get_events_url(entity: str, start: str, end: str) -> str:
"""Create a url to get events during the specified time range."""
- return f"/api/calendars/{entity}?start={urllib.parse.quote(start)}&end={urllib.parse.quote(end)}"
+ return (
+ f"/api/calendars/{entity}"
+ f"?start={urllib.parse.quote(start)}"
+ f"&end={urllib.parse.quote(end)}"
+ )
def get_events_response(start: dict[str, str], end: dict[str, str]) -> dict[str, Any]:
@@ -138,7 +142,7 @@ async def test_update_entity_for_custom_project_no_due_date_on(
hass: HomeAssistant,
api: AsyncMock,
) -> None:
- """Test that a task without an explicit due date is considered to be in an on state."""
+ """Test that a task without an explicit due date is in an on state."""
await async_update_entity(hass, "calendar.name")
state = hass.states.get("calendar.name")
assert state.state == "on"
@@ -166,7 +170,7 @@ async def test_update_entity_for_calendar_with_due_date_in_the_future(
api: AsyncMock,
due: Due,
) -> None:
- """Test that a task with a due date in the future has on state and correct end_time."""
+ """Test that a task with a future due date has on state and correct end_time."""
await async_update_entity(hass, "calendar.name")
state = hass.states.get("calendar.name")
assert state.state == "on"
diff --git a/tests/components/togrill/test_sensor.py b/tests/components/togrill/test_sensor.py
index dede1d29587..f99ffe2fbce 100644
--- a/tests/components/togrill/test_sensor.py
+++ b/tests/components/togrill/test_sensor.py
@@ -20,7 +20,7 @@ from tests.components.bluetooth import inject_bluetooth_service_info
def patch_async_ble_device_from_address(
return_value: BluetoothServiceInfoBleak | None = None,
):
- """Patch async_ble_device_from_address to return a mocked BluetoothServiceInfoBleak."""
+ """Patch async_ble_device_from_address to return a mock."""
return patch(
"homeassistant.components.bluetooth.async_ble_device_from_address",
return_value=return_value,
diff --git a/tests/components/tolo/test_config_flow.py b/tests/components/tolo/test_config_flow.py
index 8404aa9aaf9..34e4c220267 100644
--- a/tests/components/tolo/test_config_flow.py
+++ b/tests/components/tolo/test_config_flow.py
@@ -30,7 +30,8 @@ def toloclient_fixture() -> Mock:
def coordinator_toloclient() -> Mock:
"""Patch ToloClient in async_setup_entry.
- Throw exception to abort entry setup and prevent socket IO. Only testing config flow.
+ Throw exception to abort entry setup and prevent socket IO.
+ Only testing config flow.
"""
with patch(
"homeassistant.components.tolo.coordinator.ToloClient", side_effect=Exception
@@ -191,7 +192,7 @@ async def test_reconfigure_duplicate_ip(
coordinator_toloclient: Mock,
config_entry: MockConfigEntry,
) -> None:
- """Test a reconfigure flow where the user is trying to have to entries with the same IP."""
+ """Test a reconfigure flow where the user tries to duplicate an IP."""
config_entry2 = MockConfigEntry(
domain=DOMAIN, data={CONF_HOST: "127.0.0.6"}, unique_id="second_entry"
)
diff --git a/tests/components/touchline_sl/test_config_flow.py b/tests/components/touchline_sl/test_config_flow.py
index 2929cd5d0e3..c9901fb743b 100644
--- a/tests/components/touchline_sl/test_config_flow.py
+++ b/tests/components/touchline_sl/test_config_flow.py
@@ -24,7 +24,7 @@ CONFIG_DATA = {
async def test_config_flow_success(
hass: HomeAssistant, mock_setup_entry: AsyncMock, mock_touchlinesl_client: AsyncMock
) -> None:
- """Test the happy path where the provided username/password result in a new entry."""
+ """Test the happy path where username/password result in a new entry."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": SOURCE_USER}
)
@@ -58,7 +58,7 @@ async def test_config_flow_failure_api_exceptions(
mock_setup_entry: AsyncMock,
mock_touchlinesl_client: AsyncMock,
) -> None:
- """Test for invalid credentials or API connection errors, and that the form can recover."""
+ """Test for invalid credentials or API errors, and form recovery."""
mock_touchlinesl_client.user_id.side_effect = exception
result = await hass.config_entries.flow.async_init(
diff --git a/tests/components/tplink/__init__.py b/tests/components/tplink/__init__.py
index d2cf91db802..e484ec2b8ef 100644
--- a/tests/components/tplink/__init__.py
+++ b/tests/components/tplink/__init__.py
@@ -104,14 +104,18 @@ async def snapshot_platform(
unique_device_classes = []
for entity_entry in entity_entries:
if entity_entry.translation_key:
- key = f"component.{DOMAIN}.entity.{entity_entry.domain}.{entity_entry.translation_key}.name"
+ key = (
+ f"component.{DOMAIN}.entity.{entity_entry.domain}"
+ f".{entity_entry.translation_key}.name"
+ )
single_device_class_translation = False
if key not in translations: # No name translation
if entity_entry.original_device_class not in unique_device_classes:
single_device_class_translation = True
unique_device_classes.append(entity_entry.original_device_class)
assert (key in translations) or single_device_class_translation, (
- f"No translation or non unique device_class for entity {entity_entry.unique_id}, expected {key}"
+ f"No translation or non unique device_class for"
+ f" entity {entity_entry.unique_id}, expected {key}"
)
assert entity_entry == snapshot(name=f"{entity_entry.entity_id}-entry"), (
f"entity entry snapshot failed for {entity_entry.entity_id}"
@@ -266,7 +270,8 @@ def _mocked_feature(
) -> Feature:
"""Get a mocked feature.
- If kwargs are provided they will override the attributes for any features defined in fixtures.json
+ If kwargs are provided they will override the attributes for any
+ features defined in fixtures.json
"""
feature = MagicMock(spec=Feature, name=f"Mocked {id} feature")
feature.id = id
diff --git a/tests/components/tplink/test_config_flow.py b/tests/components/tplink/test_config_flow.py
index 35fd4f418de..b2a1a658952 100644
--- a/tests/components/tplink/test_config_flow.py
+++ b/tests/components/tplink/test_config_flow.py
@@ -1258,7 +1258,7 @@ async def test_manual_port_override_invalid(
async def test_discovered_by_discovery_and_dhcp(hass: HomeAssistant) -> None:
- """Test we get the form with discovery and abort for dhcp source when we get both."""
+ """Test we get the form with discovery and abort for dhcp source."""
with _patch_discovery(), _patch_single_discovery(), _patch_connect():
result = await hass.config_entries.flow.async_init(
diff --git a/tests/components/tplink/test_init.py b/tests/components/tplink/test_init.py
index 8eedd8df8f9..39174286310 100644
--- a/tests/components/tplink/test_init.py
+++ b/tests/components/tplink/test_init.py
@@ -192,8 +192,8 @@ async def test_config_entry_wrong_mac_Address(
assert already_migrated_config_entry.state is ConfigEntryState.SETUP_RETRY
assert (
- "Unexpected device found at 127.0.0.1; expected aa:bb:cc:dd:ee:f0, found aa:bb:cc:dd:ee:ff"
- in caplog.text
+ "Unexpected device found at 127.0.0.1; expected"
+ " aa:bb:cc:dd:ee:f0, found aa:bb:cc:dd:ee:ff" in caplog.text
)
@@ -273,8 +273,8 @@ async def test_config_entry_conn_params_invalid(
assert mock_config_entry.state is ConfigEntryState.LOADED
assert (
- f"Invalid connection parameters dict for {IP_ADDRESS}: {entry_data.get(CONF_CONNECTION_PARAMETERS)}"
- in caplog.text
+ f"Invalid connection parameters dict for {IP_ADDRESS}:"
+ f" {entry_data.get(CONF_CONNECTION_PARAMETERS)}" in caplog.text
)
@@ -519,8 +519,8 @@ async def test_unlink_devices(
update_msg_fragment = "identifiers for device dummy (hs300):"
update_msg = f"{expected_message} {update_msg_fragment}" if expected_message else ""
- # Expected identifiers should include all other domains or all the newer non-mac device ids
- # or just the parent mac device id
+ # Expected identifiers should include all other domains or all
+ # the newer non-mac device ids or just the parent mac device id
expected_identifiers = [
(domain, device_id)
for domain, device_id in test_identifiers
diff --git a/tests/components/tplink_omada/test_binary_sensor.py b/tests/components/tplink_omada/test_binary_sensor.py
index 9f4929fb123..821245df7b8 100644
--- a/tests/components/tplink_omada/test_binary_sensor.py
+++ b/tests/components/tplink_omada/test_binary_sensor.py
@@ -68,7 +68,7 @@ async def test_disconnected_device_sensor_not_registered(
mock_omada_site_client: MagicMock,
freezer: FrozenDateTimeFactory,
) -> None:
- """Test that if the gateway is not connected to the controller, gateway entities are not created."""
+ """Test gateway entities are not created when gateway is not connected."""
await _set_test_device_status(
hass,
diff --git a/tests/components/tplink_omada/test_services.py b/tests/components/tplink_omada/test_services.py
index b86dca98c7f..66335fa0587 100644
--- a/tests/components/tplink_omada/test_services.py
+++ b/tests/components/tplink_omada/test_services.py
@@ -140,7 +140,7 @@ async def test_service_reconnect_failed_raises_homeassistanterror(
mock_omada_client: MagicMock,
mock_config_entry: MockConfigEntry,
) -> None:
- """Test reconnect client service raises the right kind of exception on service failure."""
+ """Test reconnect client service raises correct exception on failure."""
mock_config_entry.add_to_hass(hass)
diff --git a/tests/components/tractive/test_init.py b/tests/components/tractive/test_init.py
index 71934600c01..beba2c2bc8a 100644
--- a/tests/components/tractive/test_init.py
+++ b/tests/components/tractive/test_init.py
@@ -106,8 +106,8 @@ async def test_trackable_without_details(
await init_integration(hass, mock_config_entry)
assert (
- "Tracker xyz098 has no details and will be skipped. This happens for shared trackers"
- in caplog.text
+ "Tracker xyz098 has no details and will be skipped."
+ " This happens for shared trackers" in caplog.text
)
assert mock_config_entry.state is ConfigEntryState.LOADED
diff --git a/tests/components/tradfri/test_init.py b/tests/components/tradfri/test_init.py
index e3854c41d74..c93236933e4 100644
--- a/tests/components/tradfri/test_init.py
+++ b/tests/components/tradfri/test_init.py
@@ -148,7 +148,8 @@ async def test_migrate_config_entry_and_identifiers(
name="Gateway",
)
- # Create bulb 1 on gateway 1 in Device Registry - this has the old identifiers format
+ # Create bulb 1 on gateway 1 in Device Registry
+ # this has the old identifiers format
gateway1_bulb1 = device_registry.async_get_or_create(
config_entry_id=config_entry1.entry_id,
identifiers={(tradfri.DOMAIN, 65537)},
@@ -156,13 +157,14 @@ async def test_migrate_config_entry_and_identifiers(
)
# Update bulb 1 device to have both config entry IDs
- # This is to simulate existing data scenario with older version of tradfri component
+ # This simulates existing data scenario with older tradfri version
device_registry.async_update_device(
gateway1_bulb1.id,
add_config_entry_id=config_entry2.entry_id,
)
- # Create bulb 2 on gateway 1 in Device Registry - this has the new identifiers format
+ # Create bulb 2 on gateway 1 in Device Registry
+ # this has the new identifiers format
gateway1_bulb2 = device_registry.async_get_or_create(
config_entry_id=config_entry1.entry_id,
identifiers={(tradfri.DOMAIN, f"{GATEWAY_ID1}-65538")},
@@ -212,8 +214,9 @@ async def test_migrate_config_entry_and_identifiers(
assert device_entries[0].identifiers == gateway1_device.identifiers
assert device_entries[0].config_entries == gateway1_device.config_entries
- # Validate that gateway 1 bulb 2 now only exists associated to config entry 3.
- # The device will have had its identifiers updated to the new format (for the tradfri
+ # Validate that gateway 1 bulb 2 now only exists associated to
+ # config entry 3. The device will have had its identifiers
+ # updated to the new format (for the tradfri
# domain) per migrate_config_entry_and_identifiers().
# The device will have then been removed from config entry 1 (gateway1)
# due to it not matching a device in the command store.
@@ -230,9 +233,11 @@ async def test_migrate_config_entry_and_identifiers(
("test_domain", "config_entry_3-device2"),
}
- # Validate that gateway 2 bulb 1 has been added to device registry and with correct unique identifiers
- # (This bulb device exists on gateway 2 because the command_store created above will be executed
- # for each gateway being set up.)
+ # Validate that gateway 2 bulb 1 has been added to device
+ # registry and with correct unique identifiers
+ # (This bulb device exists on gateway 2 because the
+ # command_store created above will be executed for each
+ # gateway being set up.)
device_entries = dr.async_entries_for_config_entry(
device_registry, config_entry2.entry_id
)
diff --git a/tests/components/triggercmd/test_config_flow.py b/tests/components/triggercmd/test_config_flow.py
index f12fcfef768..053023491f9 100644
--- a/tests/components/triggercmd/test_config_flow.py
+++ b/tests/components/triggercmd/test_config_flow.py
@@ -12,9 +12,19 @@ from homeassistant.data_entry_flow import FlowResultType
from tests.common import MockConfigEntry
-invalid_token_with_length_100_or_more = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjEyMzQ1Njc4OTBxd2VydHl1aW9wYXNkZiIsImlhdCI6MTcxOTg4MTU4M30.E4T2S4RQfuI2ww74sUkkT-wyTGrV5_VDkgUdae5yo4E"
+invalid_token_with_length_100_or_more = (
+ "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9"
+ ".eyJpZCI6IjEyMzQ1Njc4OTBxd2VydHl1aW9wYXNkZiIs"
+ "ImlhdCI6MTcxOTg4MTU4M30"
+ ".E4T2S4RQfuI2ww74sUkkT-wyTGrV5_VDkgUdae5yo4E"
+)
invalid_token_id = "1234567890qwertyuiopasdf"
-invalid_token_with_length_100_or_more_and_no_id = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJub2lkIjoiMTIzNDU2Nzg5MHF3ZXJ0eXVpb3Bhc2RmIiwiaWF0IjoxNzE5ODgxNTgzfQ.MaJLNWPGCE51Zibhbq-Yz7h3GkUxLurR2eoM2frnO6Y"
+invalid_token_with_length_100_or_more_and_no_id = (
+ "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9"
+ ".eyJub2lkIjoiMTIzNDU2Nzg5MHF3ZXJ0eXVpb3Bhc2Rm"
+ "IiwiaWF0IjoxNzE5ODgxNTgzfQ"
+ ".MaJLNWPGCE51Zibhbq-Yz7h3GkUxLurR2eoM2frnO6Y"
+)
async def test_full_flow(
diff --git a/tests/components/trmnl/test_sensor.py b/tests/components/trmnl/test_sensor.py
index 317e9dd0fab..65b17ce7301 100644
--- a/tests/components/trmnl/test_sensor.py
+++ b/tests/components/trmnl/test_sensor.py
@@ -58,7 +58,7 @@ async def test_dynamic_new_device(
mock_config_entry: MockConfigEntry,
freezer: FrozenDateTimeFactory,
) -> None:
- """Test that new entities are added when a new device appears in coordinator data."""
+ """Test new entities are added when a new device appears in data."""
await setup_integration(hass, mock_config_entry)
# Initially the existing device's battery sensor has a state
diff --git a/tests/components/trmnl/test_switch.py b/tests/components/trmnl/test_switch.py
index 5ee303b6b4b..977b5d0e83e 100644
--- a/tests/components/trmnl/test_switch.py
+++ b/tests/components/trmnl/test_switch.py
@@ -113,7 +113,7 @@ async def test_dynamic_new_device(
mock_config_entry: MockConfigEntry,
freezer: FrozenDateTimeFactory,
) -> None:
- """Test that new entities are added when a new device appears in coordinator data."""
+ """Test new entities are added when a new device appears in data."""
await setup_integration(hass, mock_config_entry)
assert hass.states.get("switch.test_trmnl_sleep_mode") is not None
diff --git a/tests/components/trmnl/test_time.py b/tests/components/trmnl/test_time.py
index 61cabb44704..ddba68b47b5 100644
--- a/tests/components/trmnl/test_time.py
+++ b/tests/components/trmnl/test_time.py
@@ -126,7 +126,7 @@ async def test_dynamic_new_device(
mock_config_entry: MockConfigEntry,
freezer: FrozenDateTimeFactory,
) -> None:
- """Test that new entities are added when a new device appears in coordinator data."""
+ """Test new entities are added when a new device appears in data."""
await setup_integration(hass, mock_config_entry)
assert hass.states.get("time.test_trmnl_sleep_start_time") is not None
diff --git a/tests/components/tts/test_entity.py b/tests/components/tts/test_entity.py
index 308d3bb0fca..a3b2404d3b1 100644
--- a/tests/components/tts/test_entity.py
+++ b/tests/components/tts/test_entity.py
@@ -59,7 +59,7 @@ async def test_restore_state(
async def test_tts_entity_subclass_properties(
hass: HomeAssistant, caplog: pytest.LogCaptureFixture
) -> None:
- """Test for errors when subclasses of the TextToSpeechEntity are missing required properties."""
+ """Test errors when TextToSpeechEntity subclasses miss required properties."""
class TestClass1(tts.TextToSpeechEntity):
_attr_default_language = DEFAULT_LANG
@@ -88,7 +88,9 @@ async def test_tts_entity_subclass_properties(
await mock_config_entry_setup(hass, TestClass3())
assert (
- "TTS entities must either set the '_attr_supported_languages' attribute or override the 'supported_languages' property"
+ "TTS entities must either set the"
+ " '_attr_supported_languages' attribute or override"
+ " the 'supported_languages' property"
in [
str(record.exc_info[1])
for record in caplog.records
@@ -103,7 +105,9 @@ async def test_tts_entity_subclass_properties(
await mock_config_entry_setup(hass, TestClass4())
assert (
- "TTS entities must either set the '_attr_default_language' attribute or override the 'default_language' property"
+ "TTS entities must either set the"
+ " '_attr_default_language' attribute or override"
+ " the 'default_language' property"
in [
str(record.exc_info[1])
for record in caplog.records
@@ -120,7 +124,9 @@ async def test_tts_entity_subclass_properties(
await mock_config_entry_setup(hass, TestClass5())
assert (
- "TTS entities must either set the '_attr_supported_languages' attribute or override the 'supported_languages' property"
+ "TTS entities must either set the"
+ " '_attr_supported_languages' attribute or override"
+ " the 'supported_languages' property"
in [
str(record.exc_info[1])
for record in caplog.records
@@ -137,7 +143,9 @@ async def test_tts_entity_subclass_properties(
await mock_config_entry_setup(hass, TestClass6())
assert (
- "TTS entities must either set the '_attr_default_language' attribute or override the 'default_language' property"
+ "TTS entities must either set the"
+ " '_attr_default_language' attribute or override"
+ " the 'default_language' property"
in [
str(record.exc_info[1])
for record in caplog.records
diff --git a/tests/components/tts/test_init.py b/tests/components/tts/test_init.py
index 3c67ac25716..4d1f6803bb6 100644
--- a/tests/components/tts/test_init.py
+++ b/tests/components/tts/test_init.py
@@ -175,7 +175,10 @@ async def test_service(
await hass.async_block_till_done(wait_background_tasks=True)
assert (
mock_tts_cache_dir
- / f"42f18378fd4393d18c8dd11d03fa9563c1e54491_en-us_-_{expected_url_suffix}.mp3"
+ / (
+ "42f18378fd4393d18c8dd11d03fa9563c1e54491"
+ f"_en-us_-_{expected_url_suffix}.mp3"
+ )
).is_file()
@@ -301,7 +304,10 @@ async def test_service_default_special_language(
await hass.async_block_till_done(wait_background_tasks=True)
assert (
mock_tts_cache_dir
- / f"42f18378fd4393d18c8dd11d03fa9563c1e54491_en-us_-_{expected_url_suffix}.mp3"
+ / (
+ "42f18378fd4393d18c8dd11d03fa9563c1e54491"
+ f"_en-us_-_{expected_url_suffix}.mp3"
+ )
).is_file()
@@ -361,7 +367,10 @@ async def test_service_language(
await hass.async_block_till_done(wait_background_tasks=True)
assert (
mock_tts_cache_dir
- / f"42f18378fd4393d18c8dd11d03fa9563c1e54491_de-de_-_{expected_url_suffix}.mp3"
+ / (
+ "42f18378fd4393d18c8dd11d03fa9563c1e54491"
+ f"_de-de_-_{expected_url_suffix}.mp3"
+ )
).is_file()
@@ -2082,7 +2091,7 @@ async def test_async_internal_get_tts_audio_called(
mock_tts_entity: MockTTSEntity,
hass_client: ClientSessionGenerator,
) -> None:
- """Test that non-streaming entity has its async_internal_get_tts_audio method called."""
+ """Test non-streaming entity calls async_internal_get_tts_audio."""
await mock_config_entry_setup(hass, mock_tts_entity)
diff --git a/tests/components/tuya/__init__.py b/tests/components/tuya/__init__.py
index 359c1c06486..384d9248d4c 100644
--- a/tests/components/tuya/__init__.py
+++ b/tests/components/tuya/__init__.py
@@ -43,7 +43,7 @@ class TuyaNotificationHelper:
updated_status_properties: list[str] | None,
dp_timestamps: dict[str, int] | None,
) -> None:
- """Trigger dispatcher_send for device update and wait for entity tasks to complete."""
+ """Trigger dispatcher_send for device update and wait for tasks."""
for listener in self.manager.device_listeners:
listener.update_device(device, updated_status_properties, dp_timestamps)
await self.hass.async_block_till_done()
diff --git a/tests/components/tuya/test_alarm_control_panel.py b/tests/components/tuya/test_alarm_control_panel.py
index 840706a08e9..8170c20b082 100644
--- a/tests/components/tuya/test_alarm_control_panel.py
+++ b/tests/components/tuya/test_alarm_control_panel.py
@@ -128,7 +128,10 @@ async def test_service(
"master_mode": "home",
"master_state": "alarm",
# "Sensor Low Battery Test Sensor" in UTF-16BE
- "alarm_msg": "AFMAZQBuAHMAbwByACAATABvAHcAIABCAGEAdAB0AGUAcgB5ACAAVABlAHMAdAAgAFMAZQBuAHMAbwBy",
+ "alarm_msg": (
+ "AFMAZQBuAHMAbwByACAATABvAHcAIABCAGEAdAB0"
+ "AGUAcgB5ACAAVABlAHMAdAAgAFMAZQBuAHMAbwBy"
+ ),
},
AlarmControlPanelState.ARMED_HOME,
),
diff --git a/tests/components/tuya/test_init.py b/tests/components/tuya/test_init.py
index c11bbd0ebc1..e0706211706 100644
--- a/tests/components/tuya/test_init.py
+++ b/tests/components/tuya/test_init.py
@@ -117,7 +117,7 @@ async def test_device_registry(
entity_registry: er.EntityRegistry,
snapshot: SnapshotAssertion,
) -> None:
- """Validate device registry snapshots for all devices, including unsupported ones."""
+ """Validate device registry snapshots for all devices."""
await initialize_entry(hass, mock_manager, mock_config_entry, mock_devices)
diff --git a/tests/components/tuya/test_services.py b/tests/components/tuya/test_services.py
index ac0022b321d..6ec86e51413 100644
--- a/tests/components/tuya/test_services.py
+++ b/tests/components/tuya/test_services.py
@@ -154,7 +154,9 @@ async def test_set_feeder_meal_plan_unsupported_device(
mock_device.product_id = "unsupported_product"
with pytest.raises(
ServiceValidationError,
- match=f"Feeder with ID {mock_device.id} does not support meal plan functionality",
+ match=(
+ f"Feeder with ID {mock_device.id} does not support meal plan functionality"
+ ),
):
await hass.services.async_call(
DOMAIN,
diff --git a/tests/components/twinkly/test_light.py b/tests/components/twinkly/test_light.py
index 3603ebb5f1b..826bd478bc8 100644
--- a/tests/components/twinkly/test_light.py
+++ b/tests/components/twinkly/test_light.py
@@ -212,7 +212,7 @@ async def test_turn_on_with_missing_effect(
mock_twinkly_client: AsyncMock,
data: dict[str, Any],
) -> None:
- """Test support of the light.turn_on service with rgbw color and missing effect support."""
+ """Test light.turn_on with rgbw color and missing effect support."""
mock_twinkly_client.is_on.return_value = False
mock_twinkly_client.get_firmware_version.return_value["version"] = "2.7.0"
diff --git a/tests/components/unifi/test_config_flow.py b/tests/components/unifi/test_config_flow.py
index f6d961bf1b2..eb1610a6f79 100644
--- a/tests/components/unifi/test_config_flow.py
+++ b/tests/components/unifi/test_config_flow.py
@@ -537,7 +537,7 @@ async def test_flow_integration_discovery_aborts_on_direct_connect_host(
async def test_flow_integration_discovery_updates_existing_entry_on_rediscovery(
hass: HomeAssistant,
) -> None:
- """Test that an existing entry's host is refreshed when rediscovered with the same MAC."""
+ """Test existing entry's host is refreshed when rediscovered with same MAC."""
old_entry = MockConfigEntry(
domain=DOMAIN,
unique_id=format_mac(INTEGRATION_DISCOVERY_INFO["hw_addr"]),
diff --git a/tests/components/unifi/test_device_tracker.py b/tests/components/unifi/test_device_tracker.py
index f074a92e94f..81e3e4a9338 100644
--- a/tests/components/unifi/test_device_tracker.py
+++ b/tests/components/unifi/test_device_tracker.py
@@ -448,7 +448,8 @@ async def test_wireless_client_go_wired_issue(
) -> None:
"""Test the solution to catch wireless device go wired UniFi issue.
- UniFi Network has a known issue that when a wireless device goes away it sometimes gets marked as wired.
+ UniFi Network has a known issue that when a wireless device goes away
+ it sometimes gets marked as wired.
"""
client_payload.append(
WIRELESS_CLIENT_1 | {"last_seen": dt_util.as_timestamp(dt_util.utcnow())}
@@ -585,7 +586,7 @@ async def test_restoring_client(
client_payload: list[dict[str, Any]],
clients_all_payload: list[dict[str, Any]],
) -> None:
- """Verify clients are restored from clients_all if they ever was registered to entity registry."""
+ """Verify clients are restored from clients_all if registered to entity registry."""
entity_registry.async_get_or_create(
TRACKER_DOMAIN,
DOMAIN,
diff --git a/tests/components/unifi/test_light.py b/tests/components/unifi/test_light.py
index b2aedf0f7cb..e03b7ce4e37 100644
--- a/tests/components/unifi/test_light.py
+++ b/tests/components/unifi/test_light.py
@@ -408,7 +408,7 @@ async def test_light_onoff_mode_turn_on_off(
async def test_light_rgb_vs_onoff_modes(
hass: HomeAssistant,
) -> None:
- """Test that RGB and ONOFF modes are correctly assigned based on device capabilities."""
+ """Test RGB and ONOFF modes are assigned based on device capabilities."""
assert len(hass.states.async_entity_ids(LIGHT_DOMAIN)) == 2
# Device with LED ring support should have RGB mode
diff --git a/tests/components/unifi/test_sensor.py b/tests/components/unifi/test_sensor.py
index 9104b8c0de7..8d2df550be5 100644
--- a/tests/components/unifi/test_sensor.py
+++ b/tests/components/unifi/test_sensor.py
@@ -1906,7 +1906,7 @@ async def test_device_with_no_matching_temperatures(
hass: HomeAssistant,
entity_registry: er.EntityRegistry,
) -> None:
- """Verify that device temperature sensors is not created if there is no matching data."""
+ """Verify device temperature sensors are not created without matching data."""
assert len(hass.states.async_all()) == 6
assert len(hass.states.async_entity_ids(SENSOR_DOMAIN)) == 2
diff --git a/tests/components/unifi/test_switch.py b/tests/components/unifi/test_switch.py
index 7791a7411a5..05b9db5ddb5 100644
--- a/tests/components/unifi/test_switch.py
+++ b/tests/components/unifi/test_switch.py
@@ -1271,7 +1271,8 @@ async def test_traffic_routes(
{"entity_id": "switch.unifi_network_test_traffic_route"},
blocking=True,
)
- # Updating the value for traffic routes will make another call to retrieve the values
+ # Updating the value for traffic routes will make another call
+ # to retrieve the values
assert aioclient_mock.call_count == call_count + 2
expected_disable_call = deepcopy(traffic_route)
expected_disable_call["enabled"] = False
@@ -1327,7 +1328,8 @@ async def test_firewall_policies(
{"entity_id": "switch.unifi_network_allow_internal_to_iot"},
blocking=True,
)
- # Updating the value for firewall policies will make another call to retrieve the values
+ # Updating the value for firewall policies will make another call
+ # to retrieve the values
assert aioclient_mock.call_count == call_count + 2
expected_disable_call = deepcopy(firewall_policy)
expected_disable_call["enabled"] = False
diff --git a/tests/components/unifi_access/test_binary_sensor.py b/tests/components/unifi_access/test_binary_sensor.py
index a35a1e6323e..2184c69a051 100644
--- a/tests/components/unifi_access/test_binary_sensor.py
+++ b/tests/components/unifi_access/test_binary_sensor.py
@@ -157,7 +157,7 @@ async def test_v2_device_update_empty_location_id_ignored(
init_integration: MockConfigEntry,
mock_client: MagicMock,
) -> None:
- """Test access.data.v2.device.update with empty location_id does not update state."""
+ """Test device.update with empty location_id does not update state."""
handlers = _get_ws_handlers(mock_client)
update_msg = V2DeviceUpdate(
diff --git a/tests/components/unifi_access/test_config_flow.py b/tests/components/unifi_access/test_config_flow.py
index 74968e86a35..1c2567a22e8 100644
--- a/tests/components/unifi_access/test_config_flow.py
+++ b/tests/components/unifi_access/test_config_flow.py
@@ -362,7 +362,7 @@ async def test_user_flow_ssl_context(
verify_ssl: bool,
expected_ssl_context_type: type,
) -> None:
- """Test that a pre-warmed no-verify SSL context is passed when verify_ssl is False."""
+ """Test no-verify SSL context is passed when verify_ssl is False."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": SOURCE_USER}
)
@@ -803,7 +803,7 @@ async def test_discovery_ignored_entry(
async def test_discovery_fallback_name_from_mac(
hass: HomeAssistant, mock_client: MagicMock
) -> None:
- """Test discovery confirm uses MAC-based name when hostname and platform are absent."""
+ """Test discovery uses MAC-based name when hostname and platform are absent."""
result = await hass.config_entries.flow.async_init(
DOMAIN,
context={"source": SOURCE_INTEGRATION_DISCOVERY},
diff --git a/tests/components/unifi_access/test_event.py b/tests/components/unifi_access/test_event.py
index fb86db22c1f..8854f08bfbc 100644
--- a/tests/components/unifi_access/test_event.py
+++ b/tests/components/unifi_access/test_event.py
@@ -817,7 +817,7 @@ async def test_remote_view_doorbell_ring_by_door_name_fallback(
init_integration: MockConfigEntry,
mock_client: MagicMock,
) -> None:
- """Test access.remote_view falls back to door_name lookup when device_id is unmapped."""
+ """Test remote_view falls back to door_name when device_id is unmapped."""
handlers = _get_ws_handlers(mock_client)
remote_view_msg = RemoteView(
@@ -838,7 +838,7 @@ async def test_remote_view_unknown_device_and_door_ignored(
init_integration: MockConfigEntry,
mock_client: MagicMock,
) -> None:
- """Test access.remote_view is ignored when both device_id and door_name are unknown."""
+ """Test remote_view is ignored when device_id and door_name are unknown."""
handlers = _get_ws_handlers(mock_client)
remote_view_msg = RemoteView(
@@ -859,7 +859,7 @@ async def test_remote_view_device_mapping_via_device_update(
init_integration: MockConfigEntry,
mock_client: MagicMock,
) -> None:
- """Test access.remote_view resolves device_id populated by access.data.device.update."""
+ """Test remote_view resolves device_id populated by data.device.update."""
handlers = _get_ws_handlers(mock_client)
device_update_msg = DeviceUpdate(
@@ -891,7 +891,7 @@ async def test_remote_view_device_mapping_via_v2_device_update(
init_integration: MockConfigEntry,
mock_client: MagicMock,
) -> None:
- """Test access.remote_view resolves device_id populated by access.data.v2.device.update."""
+ """Test remote_view resolves device_id from data.v2.device.update."""
handlers = _get_ws_handlers(mock_client)
v2_device_update_msg = V2DeviceUpdate(
@@ -1164,7 +1164,7 @@ async def test_logs_add_no_device_and_no_enriched_door_id_ignored(
init_integration: MockConfigEntry,
mock_client: MagicMock,
) -> None:
- """Test logs.add event is ignored when neither device mapping nor door_id resolves."""
+ """Test logs.add is ignored when neither device mapping nor door_id resolves."""
handlers = _get_ws_handlers(mock_client)
log_msg = LogAdd(
@@ -1228,7 +1228,7 @@ async def test_logs_add_direction(
init_integration: MockConfigEntry,
mock_client: MagicMock,
) -> None:
- """Test direction attribute is included in access event from logs.add when present."""
+ """Test direction attribute is included in event from logs.add."""
handlers = _get_ws_handlers(mock_client)
await _populate_device_mapping(handlers)
diff --git a/tests/components/unifi_access/test_init.py b/tests/components/unifi_access/test_init.py
index 68250a79cfc..8bca49d89d0 100644
--- a/tests/components/unifi_access/test_init.py
+++ b/tests/components/unifi_access/test_init.py
@@ -74,7 +74,7 @@ async def test_setup_entry_ssl_context(
verify_ssl: bool,
expected_ssl_context_type: type,
) -> None:
- """Test that a pre-warmed no-verify SSL context is passed when verify_ssl is False."""
+ """Test no-verify SSL context is passed when verify_ssl is False."""
entry = MockConfigEntry(
domain=DOMAIN,
title="UniFi Access",
diff --git a/tests/components/unifi_access/test_sensor.py b/tests/components/unifi_access/test_sensor.py
index 30d55c11447..b239e36386d 100644
--- a/tests/components/unifi_access/test_sensor.py
+++ b/tests/components/unifi_access/test_sensor.py
@@ -138,7 +138,7 @@ async def test_sensor_created_after_websocket_update_when_initial_fetch_fails(
mock_config_entry: MockConfigEntry,
mock_client: MagicMock,
) -> None:
- """Test websocket updates refine placeholder sensors after a transient startup error."""
+ """Test websocket updates refine placeholders after a transient startup error."""
mock_client.get_door_lock_rule = AsyncMock(
side_effect=ApiConnectionError("Connection failed")
)
diff --git a/tests/components/unifiprotect/conftest.py b/tests/components/unifiprotect/conftest.py
index 834a0f016ec..e3f13cef82a 100644
--- a/tests/components/unifiprotect/conftest.py
+++ b/tests/components/unifiprotect/conftest.py
@@ -470,7 +470,7 @@ def mock_ufp_reauth_entry():
@pytest.fixture(name="ufp_reauth_entry_alt")
def mock_ufp_reauth_entry_alt():
- """Mock the unifiprotect config entry with alternate port/SSL for reauth/reconfigure tests."""
+ """Mock the unifiprotect config entry with alt port/SSL for reauth tests."""
return MockConfigEntry(
domain=DOMAIN,
data={
diff --git a/tests/components/unifiprotect/test_binary_sensor.py b/tests/components/unifiprotect/test_binary_sensor.py
index 238f88ea8b9..d004209ee25 100644
--- a/tests/components/unifiprotect/test_binary_sensor.py
+++ b/tests/components/unifiprotect/test_binary_sensor.py
@@ -727,10 +727,11 @@ async def test_aiport_no_binary_sensor_entities(
ufp: MockUFPFixture,
aiport: AiPort,
) -> None:
- """Test that AI Port devices do not create camera-specific binary sensor entities."""
+ """Test AI Port devices do not create camera-specific binary sensors."""
await init_entry(hass, ufp, [aiport])
- # AI Port should not create any camera-specific binary sensors (motion, smart detection, etc.)
+ # AI Port should not create any camera-specific binary sensors
+ # (motion, smart detection, etc.)
# NVR HDD sensors will still be created, but no AI Port-specific entities
entity_registry = er.async_get(hass)
entities = er.async_entries_for_config_entry(entity_registry, ufp.entry.entry_id)
diff --git a/tests/components/unifiprotect/test_camera.py b/tests/components/unifiprotect/test_camera.py
index 6a987eae389..7401c883ea3 100644
--- a/tests/components/unifiprotect/test_camera.py
+++ b/tests/components/unifiprotect/test_camera.py
@@ -166,7 +166,10 @@ def validate_rtsp_camera_entity(
entity_name = f"{camera_obj.name} {channel.name} Resolution Channel (Insecure)"
unique_id = f"{camera_obj.mac}_{channel.id}_insecure"
- entity_id = f"camera.{entity_name.replace(' ', '_').replace('(', '').replace(')', '').lower()}"
+ entity_id = (
+ "camera."
+ f"{entity_name.replace(' ', '_').replace('(', '').replace(')', '').lower()}"
+ )
entity_registry = er.async_get(hass)
entity = entity_registry.async_get(entity_id)
diff --git a/tests/components/unifiprotect/test_config_flow.py b/tests/components/unifiprotect/test_config_flow.py
index e18615081ae..e3f8289d993 100644
--- a/tests/components/unifiprotect/test_config_flow.py
+++ b/tests/components/unifiprotect/test_config_flow.py
@@ -676,10 +676,10 @@ async def test_discovered_by_unifi_discovery_direct_connect_updated(
assert mock_config.data[CONF_HOST] == DIRECT_CONNECT_DOMAIN
-async def test_discovered_by_unifi_discovery_direct_connect_updated_but_not_using_direct_connect(
+async def test_discovered_by_unifi_discovery_dc_updated_but_not_using_dc(
hass: HomeAssistant,
) -> None:
- """Test a discovery from unifi-discovery updates the host but not direct connect if its not in use."""
+ """Test discovery updates the host but not direct connect if not in use."""
mock_config = MockConfigEntry(
domain=DOMAIN,
data={
@@ -713,10 +713,10 @@ async def test_discovered_by_unifi_discovery_direct_connect_updated_but_not_usin
assert mock_config.data[CONF_HOST] == "127.0.0.1"
-async def test_discovered_by_unifi_discovery_does_not_update_ip_when_console_is_still_online(
+async def test_discovered_by_unifi_discovery_no_update_ip_when_console_online(
hass: HomeAssistant,
) -> None:
- """Test a discovery from unifi-discovery does not update the ip unless the console at the old ip is offline."""
+ """Test discovery does not update IP unless old console is offline."""
mock_config = MockConfigEntry(
domain=DOMAIN,
data={
@@ -948,10 +948,10 @@ async def test_discovered_by_unifi_discovery_direct_connect_on_different_interfa
assert result["reason"] == "already_configured"
-async def test_discovered_by_unifi_discovery_direct_connect_on_different_interface_ip_matches(
+async def test_discovered_by_unifi_discovery_dc_different_interface_ip_matches(
hass: HomeAssistant,
) -> None:
- """Test a discovery from unifi-discovery from an alternate interface when the ip matches."""
+ """Test discovery from alternate interface when the IP matches."""
mock_config = MockConfigEntry(
domain=DOMAIN,
data={
@@ -978,10 +978,10 @@ async def test_discovered_by_unifi_discovery_direct_connect_on_different_interfa
assert result["reason"] == "already_configured"
-async def test_discovered_by_unifi_discovery_direct_connect_on_different_interface_resolver(
+async def test_discovered_by_unifi_discovery_dc_different_interface_resolver(
hass: HomeAssistant,
) -> None:
- """Test a discovery from unifi-discovery from an alternate interface when direct connect domain resolves to host ip."""
+ """Test discovery from alternate interface when direct connect resolves."""
mock_config = MockConfigEntry(
domain=DOMAIN,
data={
@@ -1019,10 +1019,10 @@ async def test_discovered_by_unifi_discovery_direct_connect_on_different_interfa
assert result["reason"] == "already_configured"
-async def test_discovered_by_unifi_discovery_direct_connect_on_different_interface_resolver_fails(
+async def test_discovered_by_unifi_discovery_dc_different_interface_resolver_fails(
hass: HomeAssistant, bootstrap: Bootstrap, nvr: NVR
) -> None:
- """Test we can still configure if the resolver fails."""
+ """Test we can still configure when the resolver fails."""
mock_config = MockConfigEntry(
domain=DOMAIN,
data={
@@ -1110,10 +1110,10 @@ async def test_discovered_by_unifi_discovery_direct_connect_on_different_interfa
assert len(mock_setup.mock_calls) == 1
-async def test_discovered_by_unifi_discovery_direct_connect_on_different_interface_resolver_no_result(
+async def test_discovered_by_unifi_discovery_dc_different_interface_resolver_no_result(
hass: HomeAssistant,
) -> None:
- """Test a discovery from unifi-discovery from an alternate interface when direct connect domain resolve has no result."""
+ """Test discovery from alternate interface when resolve has no result."""
mock_config = MockConfigEntry(
domain=DOMAIN,
data={
diff --git a/tests/components/unifiprotect/test_event.py b/tests/components/unifiprotect/test_event.py
index a0a33ea6ae5..0159629e2ee 100644
--- a/tests/components/unifiprotect/test_event.py
+++ b/tests/components/unifiprotect/test_event.py
@@ -964,7 +964,8 @@ async def test_vehicle_detection_multiple_thumbnails(
unsub = async_track_state_change_event(hass, entity_id, _capture_event)
- # Create event with multiple vehicle thumbnails - best should be highest confidence LPR
+ # Create event with multiple vehicle thumbnails
+ # best should be highest confidence LPR
event = Event(
model=ModelType.EVENT,
id="test_multi_thumbnail_id",
@@ -1605,5 +1606,6 @@ async def test_aiport_no_event_entities(
"""Test that AI Port devices do not create camera-specific event entities."""
await init_entry(hass, ufp, [aiport])
- # AI Port should not create any camera-specific event entities (doorbell, motion, etc.)
+ # AI Port should not create any camera-specific event entities
+ # (doorbell, motion, etc.)
assert_entity_counts(hass, Platform.EVENT, 0, 0)
diff --git a/tests/components/unifiprotect/test_init.py b/tests/components/unifiprotect/test_init.py
index 7ded3c71d7f..0425983bce7 100644
--- a/tests/components/unifiprotect/test_init.py
+++ b/tests/components/unifiprotect/test_init.py
@@ -308,7 +308,7 @@ async def test_setup_failed_error(hass: HomeAssistant, ufp: MockUFPFixture) -> N
async def test_setup_failed_auth(hass: HomeAssistant, ufp: MockUFPFixture) -> None:
- """Test setup of unifiprotect entry with unauthorized error after multiple retries."""
+ """Test setup of unifiprotect entry with unauthorized error after retries."""
ufp.api.update = AsyncMock(side_effect=NotAuthorized)
@@ -437,7 +437,7 @@ async def test_async_ufp_instance_for_config_entry_ids(
mock_entries: list[MockConfigEntry],
expected_result: str | None,
) -> None:
- """Test async_ufp_instance_for_config_entry_ids with various entry configurations."""
+ """Test async_ufp_instance_for_config_entry_ids with various configs."""
for index, entry in enumerate(mock_entries):
entry.add_to_hass(hass)
@@ -523,7 +523,8 @@ async def test_setup_handles_api_key_creation_bad_request(
hass: HomeAssistant, ufp: MockUFPFixture, mock_user_can_write_nvr: Mock
) -> None:
"""Test handling of API key creation BadRequest error."""
- # Setup: API key is not set, user has write permissions, but creation fails with BadRequest
+ # Setup: API key is not set, user has write permissions,
+ # but creation fails with BadRequest
ufp.api.is_api_key_set.return_value = False
ufp.api.create_api_key = AsyncMock(
side_effect=BadRequest("Invalid API key creation request")
diff --git a/tests/components/unifiprotect/test_media_source.py b/tests/components/unifiprotect/test_media_source.py
index 875932e3e83..7c7fed8ee2c 100644
--- a/tests/components/unifiprotect/test_media_source.py
+++ b/tests/components/unifiprotect/test_media_source.py
@@ -655,8 +655,8 @@ async def test_browse_media_recent_truncated(
browse = await source.async_browse_media(media_item)
assert (
- browse.title
- == f"UnifiProtect > {doorbell.name} > Motion Events > Last 24 Hours (1 TRUNCATED)"
+ browse.title == f"UnifiProtect > {doorbell.name} > Motion Events"
+ " > Last 24 Hours (1 TRUNCATED)"
)
assert browse.identifier == base_id
assert len(browse.children) == 1
@@ -898,7 +898,10 @@ async def test_browse_media_browse_day(
event._api = ufp.api
ufp.api.get_events_raw = AsyncMock(return_value=[event.unifi_dict()])
- base_id = f"test_id:browse:{doorbell.id}:motion:range:{fixed_now.year}:{fixed_now.month}:1"
+ base_id = (
+ f"test_id:browse:{doorbell.id}:motion:range"
+ f":{fixed_now.year}:{fixed_now.month}:1"
+ )
source = await async_get_media_source(hass)
media_item = MediaSourceItem(hass, DOMAIN, base_id, None)
@@ -906,8 +909,8 @@ async def test_browse_media_browse_day(
start = fixed_now.replace(day=1)
assert (
- browse.title
- == f"UnifiProtect > {doorbell.name} > Motion Events > {fixed_now.strftime('%B %Y')} > {start.strftime('%x')} (1)"
+ browse.title == f"UnifiProtect > {doorbell.name} > Motion Events"
+ f" > {fixed_now.strftime('%B %Y')} > {start.strftime('%x')} (1)"
)
assert browse.identifier == base_id
assert len(browse.children) == 1
@@ -949,8 +952,8 @@ async def test_browse_media_browse_whole_month(
browse = await source.async_browse_media(media_item)
assert (
- browse.title
- == f"UnifiProtect > {doorbell.name} > All Events > {fixed_now.strftime('%B %Y')} > Whole Month (1)"
+ browse.title == f"UnifiProtect > {doorbell.name} > All Events"
+ f" > {fixed_now.strftime('%B %Y')} > Whole Month (1)"
)
assert browse.identifier == base_id
assert len(browse.children) == 1
@@ -1036,8 +1039,8 @@ async def test_browse_media_browse_whole_month_december(
browse = await source.async_browse_media(media_item)
assert (
- browse.title
- == f"UnifiProtect > {doorbell.name} > All Events > {fixed_now.strftime('%B %Y')} > Whole Month (1)"
+ browse.title == f"UnifiProtect > {doorbell.name} > All Events"
+ f" > {fixed_now.strftime('%B %Y')} > Whole Month (1)"
)
assert browse.identifier == base_id
assert len(browse.children) == 1
diff --git a/tests/components/unifiprotect/test_relay.py b/tests/components/unifiprotect/test_relay.py
index c9b97415ebc..51c0b613a97 100644
--- a/tests/components/unifiprotect/test_relay.py
+++ b/tests/components/unifiprotect/test_relay.py
@@ -447,7 +447,7 @@ async def test_relay_switch_command_when_output_gone(
hass: HomeAssistant,
ufp_with_relay: tuple[MockUFPFixture, Mock],
) -> None:
- """Command raises HomeAssistantError when the relay output channel is no longer present."""
+ """Command raises HomeAssistantError when relay output channel is gone."""
ufp, relay = ufp_with_relay
await init_entry(hass, ufp, [])
diff --git a/tests/components/unifiprotect/test_services.py b/tests/components/unifiprotect/test_services.py
index 8434721db5b..003d0e514b9 100644
--- a/tests/components/unifiprotect/test_services.py
+++ b/tests/components/unifiprotect/test_services.py
@@ -525,7 +525,7 @@ async def test_ptz_goto_home_preset_client_error(
ufp: MockUFPFixture,
ptz_camera: Camera,
) -> None:
- """Test ptz_goto_preset service with home preset when ptz_goto_preset_public raises ClientError."""
+ """Test ptz_goto_preset with home preset when it raises ClientError."""
ptz_camera.get_ptz_patrols.return_value = []
await init_entry(hass, ufp, [ptz_camera])
diff --git a/tests/components/unifiprotect/test_siren.py b/tests/components/unifiprotect/test_siren.py
index 51e0d30f58a..4df1b3b9451 100644
--- a/tests/components/unifiprotect/test_siren.py
+++ b/tests/components/unifiprotect/test_siren.py
@@ -179,7 +179,7 @@ async def test_siren_turn_on_with_duration(
seconds: int,
expected: SirenDuration,
) -> None:
- """Passing a valid duration to turn_on calls play with the matching SirenDuration."""
+ """Valid duration to turn_on calls play with matching SirenDuration."""
await init_entry(hass, ufp_with_siren, [])
await hass.services.async_call(
@@ -603,7 +603,7 @@ async def test_siren_auto_off_timer_scheduled_at_startup(
ufp_with_siren: MockUFPFixture,
siren: Mock,
) -> None:
- """Auto-off timer is scheduled during async_added_to_hass for an already-active siren.
+ """Auto-off timer is scheduled for an already-active siren.
If a timed run is already in progress when HA starts, the entity must
schedule its own auto-off callback immediately (not wait for a WS update)
diff --git a/tests/components/unifiprotect/utils.py b/tests/components/unifiprotect/utils.py
index fb7fda8e6bb..a97b4fcd587 100644
--- a/tests/components/unifiprotect/utils.py
+++ b/tests/components/unifiprotect/utils.py
@@ -126,7 +126,7 @@ async def ids_from_device_description(
device: ProtectAdoptableDeviceModel,
description: EntityDescription,
) -> tuple[str, str]:
- """Return expected unique_id and entity_id using real Home Assistant translation logic."""
+ """Return expected unique_id and entity_id using HA translation logic."""
entity_name = normalize_name(device.display_name)
diff --git a/tests/components/upcloud/test_config_flow.py b/tests/components/upcloud/test_config_flow.py
index 51ee8875ec3..da669ed1c08 100644
--- a/tests/components/upcloud/test_config_flow.py
+++ b/tests/components/upcloud/test_config_flow.py
@@ -58,7 +58,8 @@ async def test_login_error(
ANY,
exc=UpCloudAPIError(
error_code="AUTHENTICATION_FAILED",
- error_message="Authentication failed using the given username and password.",
+ error_message="Authentication failed using the given"
+ " username and password.",
),
)
result = await hass.config_entries.flow.async_init(
diff --git a/tests/components/update/test_init.py b/tests/components/update/test_init.py
index a606ef43a4c..31b77977b09 100644
--- a/tests/components/update/test_init.py
+++ b/tests/components/update/test_init.py
@@ -323,7 +323,8 @@ async def test_entity_with_auto_update(
# Should not be able to clear a skipped the update
with pytest.raises(
HomeAssistantError,
- match="Clearing skipped update is not supported for update.update_with_auto_update",
+ match="Clearing skipped update is not supported"
+ " for update.update_with_auto_update",
):
await hass.services.async_call(
DOMAIN,
diff --git a/tests/components/update/test_trigger.py b/tests/components/update/test_trigger.py
index ac8914792c3..da34c747383 100644
--- a/tests/components/update/test_trigger.py
+++ b/tests/components/update/test_trigger.py
@@ -89,7 +89,7 @@ async def test_update_state_trigger_behavior_any(
trigger_options: dict[str, Any],
states: list[TriggerStateDescription],
) -> None:
- """Test that the update state trigger fires when any update state changes to a specific state."""
+ """Test update state trigger fires when any update changes to a specific state."""
await assert_trigger_behavior_any(
hass,
target_entities=target_updates,
@@ -127,7 +127,7 @@ async def test_update_state_trigger_behavior_first(
trigger_options: dict[str, Any],
states: list[TriggerStateDescription],
) -> None:
- """Test that the update state trigger fires when the first update changes to a specific state."""
+ """Test update state trigger fires when first update changes to a specific state."""
await assert_trigger_behavior_first(
hass,
target_entities=target_updates,
@@ -165,7 +165,7 @@ async def test_update_state_trigger_behavior_last(
trigger_options: dict[str, Any],
states: list[TriggerStateDescription],
) -> None:
- """Test that the update state trigger fires when the last update changes to a specific state."""
+ """Test update state trigger fires when last update changes to a specific state."""
await assert_trigger_behavior_last(
hass,
target_entities=target_updates,
diff --git a/tests/components/upnp/test_config_flow.py b/tests/components/upnp/test_config_flow.py
index fb650ac7a47..d7973cc6ffc 100644
--- a/tests/components/upnp/test_config_flow.py
+++ b/tests/components/upnp/test_config_flow.py
@@ -141,7 +141,7 @@ async def test_flow_ssdp_non_igd_device(hass: HomeAssistant) -> None:
ssdp_location=TEST_LOCATION,
ssdp_all_locations=[TEST_LOCATION],
upnp={
- ATTR_UPNP_DEVICE_TYPE: "urn:schemas-upnp-org:device:WFADevice:1", # Non-IGD
+ ATTR_UPNP_DEVICE_TYPE: "urn:schemas-upnp-org:device:WFADevice:1",
},
),
)
@@ -184,7 +184,7 @@ async def test_flow_ssdp_no_mac_address(hass: HomeAssistant) -> None:
@pytest.mark.usefixtures("mock_mac_address_from_host")
async def test_flow_ssdp_discovery_changed_udn_match_mac(hass: HomeAssistant) -> None:
- """Test config flow: discovery through ssdp, same device, but new UDN, matched on mac address."""
+ """Test config flow: ssdp discovery, same device, new UDN, matched on MAC."""
entry = MockConfigEntry(
domain=DOMAIN,
unique_id=TEST_USN,
@@ -216,7 +216,7 @@ async def test_flow_ssdp_discovery_changed_udn_match_mac(hass: HomeAssistant) ->
@pytest.mark.usefixtures("mock_mac_address_from_host")
async def test_flow_ssdp_discovery_changed_udn_match_host(hass: HomeAssistant) -> None:
- """Test config flow: discovery through ssdp, same device, but new UDN, matched on mac address."""
+ """Test config flow: ssdp discovery, same device, new UDN, matched on host."""
entry = MockConfigEntry(
domain=DOMAIN,
unique_id=TEST_USN,
@@ -253,7 +253,7 @@ async def test_flow_ssdp_discovery_changed_udn_match_host(hass: HomeAssistant) -
async def test_flow_ssdp_discovery_changed_udn_but_st_differs(
hass: HomeAssistant,
) -> None:
- """Test config flow: discovery through ssdp, same device, but new UDN, and different ST, so not matched --> new discovery."""
+ """Test config flow: ssdp discovery, same device, new UDN, different ST."""
entry = MockConfigEntry(
domain=DOMAIN,
unique_id=TEST_USN,
@@ -342,7 +342,7 @@ async def test_flow_ssdp_discovery_changed_location(hass: HomeAssistant) -> None
@pytest.mark.usefixtures("mock_mac_address_from_host")
async def test_flow_ssdp_discovery_ignored_entry(hass: HomeAssistant) -> None:
- """Test config flow: discovery through ssdp, same device, but new UDN, matched on mac address."""
+ """Test config flow: ssdp, same device, new UDN, matched on MAC."""
entry = MockConfigEntry(
domain=DOMAIN,
unique_id=TEST_USN,
@@ -370,7 +370,7 @@ async def test_flow_ssdp_discovery_ignored_entry(hass: HomeAssistant) -> None:
async def test_flow_ssdp_discovery_changed_udn_ignored_entry(
hass: HomeAssistant,
) -> None:
- """Test config flow: discovery through ssdp, same device, but new UDN, matched on mac address, entry ignored."""
+ """Test config flow: ssdp, same device, new UDN, matched on MAC, ignored."""
entry = MockConfigEntry(
domain=DOMAIN,
unique_id=TEST_USN,
@@ -450,7 +450,7 @@ async def test_flow_user_no_discovery(hass: HomeAssistant) -> None:
"mock_mac_address_from_host",
)
async def test_flow_ssdp_with_mismatched_udn(hass: HomeAssistant) -> None:
- """Test config flow: discovered + configured through ssdp, where the UDN differs in the SSDP-discovery vs device description."""
+ """Test config flow: UDN differs in SSDP-discovery vs device description."""
# Discovered via step ssdp.
test_discovery = copy.deepcopy(TEST_DISCOVERY)
test_discovery.upnp[ATTR_UPNP_UDN] = "uuid:another_udn"
diff --git a/tests/components/upnp/test_init.py b/tests/components/upnp/test_init.py
index 3ddb5d48d73..448d2c11853 100644
--- a/tests/components/upnp/test_init.py
+++ b/tests/components/upnp/test_init.py
@@ -122,7 +122,7 @@ async def test_async_setup_entry_multi_location(
async def test_async_setup_udn_mismatch(
hass: HomeAssistant, mock_async_create_device: AsyncMock
) -> None:
- """Test async_setup_entry for a device which reports a different UDN from SSDP-discovery and device description."""
+ """Test async_setup_entry for a device with different UDN from SSDP."""
test_discovery = copy.deepcopy(TEST_DISCOVERY)
test_discovery.upnp[ATTR_UPNP_UDN] = "uuid:another_udn"
@@ -236,7 +236,8 @@ async def test_async_setup_entry_force_poll_subscribe_error(
mock_igd_device.async_subscribe_services.side_effect = UpnpCommunicationError
mock_igd_device.async_unsubscribe_services.side_effect = UpnpCommunicationError
- # Load config_entry, should still be able to load, falling back to polling/the old functionality.
+ # Load config_entry, should still be able to load,
+ # falling back to polling/the old functionality.
entry.add_to_hass(hass)
assert await hass.config_entries.async_setup(entry.entry_id) is True
diff --git a/tests/components/uptime_kuma/test_config_flow.py b/tests/components/uptime_kuma/test_config_flow.py
index b73628bb8b0..e84d221a844 100644
--- a/tests/components/uptime_kuma/test_config_flow.py
+++ b/tests/components/uptime_kuma/test_config_flow.py
@@ -462,7 +462,7 @@ async def test_hassio_addon_discovery_ignored(
async def test_hassio_addon_discovery_update_info(
hass: HomeAssistant,
) -> None:
- """Test we abort discovery flow if already configured and we update from discovery info."""
+ """Test we abort discovery flow if already configured and update info."""
entry = MockConfigEntry(
domain=DOMAIN,
diff --git a/tests/components/uptimerobot/test_init.py b/tests/components/uptimerobot/test_init.py
index 46781fd2e68..101c1d86af2 100644
--- a/tests/components/uptimerobot/test_init.py
+++ b/tests/components/uptimerobot/test_init.py
@@ -55,8 +55,8 @@ async def test_reauthentication_trigger_in_setup(
assert flow["context"]["entry_id"] == mock_config_entry.entry_id
assert (
- "Config entry 'test@test.test' for uptimerobot integration could not authenticate"
- in caplog.text
+ "Config entry 'test@test.test' for uptimerobot integration"
+ " could not authenticate" in caplog.text
)
@@ -88,8 +88,8 @@ async def test_reauthentication_trigger_key_read_only(
assert flow["context"]["entry_id"] == mock_config_entry.entry_id
assert (
- "Config entry 'test@test.test' for uptimerobot integration could not authenticate"
- in caplog.text
+ "Config entry 'test@test.test' for uptimerobot integration"
+ " could not authenticate" in caplog.text
)
@@ -195,7 +195,7 @@ async def test_device_management(
device_registry: dr.DeviceRegistry,
freezer: FrozenDateTimeFactory,
) -> None:
- """Test that we are adding and removing devices for monitors returned from the API."""
+ """Test adding and removing devices for monitors returned from the API."""
mock_entry = await setup_uptimerobot_integration(hass)
devices = dr.async_entries_for_config_entry(device_registry, mock_entry.entry_id)
diff --git a/tests/components/usb/test_init.py b/tests/components/usb/test_init.py
index 561c78cd6b3..39da6c140f5 100644
--- a/tests/components/usb/test_init.py
+++ b/tests/components/usb/test_init.py
@@ -253,7 +253,7 @@ async def test_discovered_by_websocket_scan(
async def test_discovered_by_websocket_scan_limited_by_description_matcher(
hass: HomeAssistant, hass_ws_client: WebSocketGenerator
) -> None:
- """Test a device is discovered from websocket scan is limited by the description matcher."""
+ """Test websocket scan discovery is limited by the description matcher."""
new_usb = [
{"domain": "test1", "vid": "3039", "pid": "3039", "description": "*2652*"}
]
@@ -380,7 +380,7 @@ async def test_most_targeted_matcher_wins(
async def test_discovered_by_websocket_scan_rejected_by_description_matcher(
hass: HomeAssistant, hass_ws_client: WebSocketGenerator
) -> None:
- """Test a device is discovered from websocket scan rejected by the description matcher."""
+ """Test websocket scan discovery rejected by the description matcher."""
new_usb = [
{"domain": "test1", "vid": "3039", "pid": "3039", "description": "*not_it*"}
]
@@ -418,7 +418,7 @@ async def test_discovered_by_websocket_scan_rejected_by_description_matcher(
async def test_discovered_by_websocket_scan_limited_by_serial_number_matcher(
hass: HomeAssistant, hass_ws_client: WebSocketGenerator
) -> None:
- """Test a device is discovered from websocket scan is limited by the serial_number matcher."""
+ """Test websocket scan discovery is limited by the serial_number matcher."""
new_usb = [
{
"domain": "test1",
@@ -462,7 +462,7 @@ async def test_discovered_by_websocket_scan_limited_by_serial_number_matcher(
async def test_discovered_by_websocket_scan_rejected_by_serial_number_matcher(
hass: HomeAssistant, hass_ws_client: WebSocketGenerator
) -> None:
- """Test a device is discovered from websocket scan is rejected by the serial_number matcher."""
+ """Test websocket scan discovery is rejected by the serial_number matcher."""
new_usb = [
{"domain": "test1", "vid": "3039", "pid": "3039", "serial_number": "123*"}
]
@@ -500,7 +500,7 @@ async def test_discovered_by_websocket_scan_rejected_by_serial_number_matcher(
async def test_discovered_by_websocket_scan_limited_by_manufacturer_matcher(
hass: HomeAssistant, hass_ws_client: WebSocketGenerator
) -> None:
- """Test a device is discovered from websocket scan is limited by the manufacturer matcher."""
+ """Test websocket scan discovery is limited by the manufacturer matcher."""
new_usb = [
{
"domain": "test1",
@@ -544,7 +544,7 @@ async def test_discovered_by_websocket_scan_limited_by_manufacturer_matcher(
async def test_discovered_by_websocket_scan_rejected_by_manufacturer_matcher(
hass: HomeAssistant, hass_ws_client: WebSocketGenerator
) -> None:
- """Test a device is discovered from websocket scan is rejected by the manufacturer matcher."""
+ """Test websocket scan discovery is rejected by the manufacturer matcher."""
new_usb = [
{
"domain": "test1",
@@ -587,7 +587,7 @@ async def test_discovered_by_websocket_scan_rejected_by_manufacturer_matcher(
async def test_discovered_by_websocket_rejected_with_empty_serial_number_only(
hass: HomeAssistant, hass_ws_client: WebSocketGenerator
) -> None:
- """Test a device is discovered from websocket is rejected with empty serial number."""
+ """Test websocket discovery is rejected with empty serial number."""
new_usb = [
{"domain": "test1", "vid": "3039", "pid": "3039", "serial_number": "123*"}
]
@@ -662,7 +662,7 @@ async def test_discovered_by_websocket_scan_match_vid_only(
async def test_discovered_by_websocket_scan_match_vid_wrong_pid(
hass: HomeAssistant, hass_ws_client: WebSocketGenerator
) -> None:
- """Test a device is discovered from websocket scan only matching vid but wrong pid."""
+ """Test websocket scan discovery matching vid but wrong pid."""
new_usb = [{"domain": "test1", "vid": "3039", "pid": "9999"}]
mock_ports = [
@@ -769,7 +769,7 @@ async def test_non_matching_discovered_by_scanner_after_started(
async def test_aiousbwatcher_on_wsl_fallback_without_throwing_exception(
hass: HomeAssistant, hass_ws_client: WebSocketGenerator
) -> None:
- """Test that aiousbwatcher on WSL failure results in fallback to scanning without raising an exception."""
+ """Test aiousbwatcher WSL failure falls back to scanning without exception."""
new_usb = [{"domain": "test1", "vid": "3039"}]
mock_ports = [
diff --git a/tests/components/utility_meter/test_config_flow.py b/tests/components/utility_meter/test_config_flow.py
index 0aa73d6d123..9c4c7a40021 100644
--- a/tests/components/utility_meter/test_config_flow.py
+++ b/tests/components/utility_meter/test_config_flow.py
@@ -328,7 +328,7 @@ async def test_change_device_source(
device_registry: dr.DeviceRegistry,
entity_registry: er.EntityRegistry,
) -> None:
- """Test remove the device registry configuration entry when the source entity changes."""
+ """Test remove device registry config entry when source entity changes."""
# Configure source entity 1 (with a linked device)
source_config_entry_1 = MockConfigEntry()
source_config_entry_1.add_to_hass(hass)
@@ -403,7 +403,8 @@ async def test_change_device_source(
assert await hass.config_entries.async_setup(utility_meter_config_entry.entry_id)
await hass.async_block_till_done()
- # Confirm that the configuration entry has not been added to the source entity 1 (current) device registry
+ # Confirm that the configuration entry has not been added
+ # to the source entity 1 (current) device registry
current_device = device_registry.async_get(
device_id=current_entity_source.device_id
)
@@ -417,7 +418,8 @@ async def test_change_device_source(
):
assert utility_meter_entity.device_id == source_entity_1.device_id
- # Change configuration options to use source entity 2 (with a linked device) and reload the integration
+ # Change configuration options to use source entity 2
+ # (with a linked device) and reload the integration
previous_entity_source = source_entity_1
current_entity_source = source_entity_2
@@ -435,13 +437,15 @@ async def test_change_device_source(
assert result["type"] is FlowResultType.CREATE_ENTRY
await hass.async_block_till_done()
- # Confirm that the configuration entry is not in the source entity 1 (previous) device registry
+ # Confirm that the configuration entry is not in the
+ # source entity 1 (previous) device registry
previous_device = device_registry.async_get(
device_id=previous_entity_source.device_id
)
assert utility_meter_config_entry.entry_id not in previous_device.config_entries
- # Confirm that the configuration entry is not in to the source entity 2 (current) device registry
+ # Confirm that the configuration entry is not in
+ # the source entity 2 (current) device registry
current_device = device_registry.async_get(
device_id=current_entity_source.device_id
)
@@ -455,7 +459,8 @@ async def test_change_device_source(
):
assert utility_meter_entity.device_id == source_entity_2.device_id
- # Change configuration options to use source entity 3 (without a device) and reload the integration
+ # Change configuration options to use source entity 3
+ # (without a device) and reload the integration
previous_entity_source = source_entity_2
current_entity_source = source_entity_3
@@ -473,7 +478,8 @@ async def test_change_device_source(
assert result["type"] is FlowResultType.CREATE_ENTRY
await hass.async_block_till_done()
- # Confirm that the configuration entry has is not in the source entity 2 (previous) device registry
+ # Confirm that the configuration entry is not in the
+ # source entity 2 (previous) device registry
previous_device = device_registry.async_get(
device_id=previous_entity_source.device_id
)
@@ -495,7 +501,8 @@ async def test_change_device_source(
== []
)
- # Change configuration options to use source entity 2 (with a linked device) and reload the integration
+ # Change configuration options to use source entity 2
+ # (with a linked device) and reload the integration
previous_entity_source = source_entity_3
current_entity_source = source_entity_2
@@ -513,7 +520,8 @@ async def test_change_device_source(
assert result["type"] is FlowResultType.CREATE_ENTRY
await hass.async_block_till_done()
- # Confirm that the configuration entry is not in the source entity 2 (current) device registry
+ # Confirm that the configuration entry is not in the
+ # source entity 2 (current) device registry
current_device = device_registry.async_get(
device_id=current_entity_source.device_id
)
diff --git a/tests/components/utility_meter/test_init.py b/tests/components/utility_meter/test_init.py
index e36508c76de..2c4c8d0b9e3 100644
--- a/tests/components/utility_meter/test_init.py
+++ b/tests/components/utility_meter/test_init.py
@@ -553,7 +553,7 @@ async def test_async_handle_source_entity_changes_source_entity_removed(
sensor_entity_entry: er.RegistryEntry,
expected_entities: set[str],
) -> None:
- """Test the utility_meter config entry is removed when the source entity is removed."""
+ """Test config entry is removed when the source entity is removed."""
assert await hass.config_entries.async_setup(utility_meter_config_entry.entry_id)
await hass.async_block_till_done()
@@ -628,7 +628,7 @@ async def test_async_handle_source_entity_changes_source_entity_removed_shared_d
sensor_entity_entry: er.RegistryEntry,
expected_entities: set[str],
) -> None:
- """Test the utility_meter config entry is removed when the source entity is removed."""
+ """Test config entry is removed when the source entity is removed."""
# Add another config entry to the sensor device
other_config_entry = MockConfigEntry()
other_config_entry.add_to_hass(hass)
diff --git a/tests/components/utility_meter/test_sensor.py b/tests/components/utility_meter/test_sensor.py
index c13adeddad4..146808975b7 100644
--- a/tests/components/utility_meter/test_sensor.py
+++ b/tests/components/utility_meter/test_sensor.py
@@ -1672,7 +1672,8 @@ async def _test_self_reset(
now += timedelta(seconds=30)
with freeze_time(now):
- # Listen for events and check that state in the first event after reset is actually 0, issue #142053
+ # Listen for events and check that state in the first event
+ # after reset is actually 0, issue #142053
events = []
async def handle_energy_bill_event(event):
@@ -1712,7 +1713,8 @@ async def _test_self_reset(
start_time_str = dt_util.parse_datetime(start_time).isoformat()
assert state.attributes.get("last_reset") == start_time_str
- # Check next day when nothing should happen for weekly, monthly, bimonthly and yearly
+ # Check next day when nothing should happen for weekly,
+ # monthly, bimonthly and yearly
if config["utility_meter"]["energy_bill"].get("cycle") in [
QUARTER_HOURLY,
HOURLY,
@@ -1982,7 +1984,7 @@ def test_calculate_adjustment_invalid_new_state(
hass: HomeAssistant,
caplog: pytest.LogCaptureFixture,
) -> None:
- """Test that calculate_adjustment method returns None if the new state is invalid."""
+ """Test calculate_adjustment returns None if the new state is invalid."""
mock_sensor = UtilityMeterSensor(
hass,
cron_pattern=None,
@@ -2009,7 +2011,7 @@ async def test_unit_of_measurement_missing_invalid_new_state(
hass: HomeAssistant,
caplog: pytest.LogCaptureFixture,
) -> None:
- """Test that a suggestion is created when new_state is missing unit_of_measurement."""
+ """Test suggestion is created when new_state has no unit_of_measurement."""
yaml_config = {
"utility_meter": {
"energy_bill": {
diff --git a/tests/components/vacuum/test_device_condition.py b/tests/components/vacuum/test_device_condition.py
index 028998b6d14..43123303b4a 100644
--- a/tests/components/vacuum/test_device_condition.py
+++ b/tests/components/vacuum/test_device_condition.py
@@ -133,7 +133,11 @@ async def test_if_state(
"action": {
"service": "test.automation",
"data_template": {
- "some": "is_cleaning - {{ trigger.platform }} - {{ trigger.event.event_type }}"
+ "some": (
+ "is_cleaning"
+ " - {{ trigger.platform }}"
+ " - {{ trigger.event.event_type }}"
+ )
},
},
},
@@ -151,7 +155,11 @@ async def test_if_state(
"action": {
"service": "test.automation",
"data_template": {
- "some": "is_docked - {{ trigger.platform }} - {{ trigger.event.event_type }}"
+ "some": (
+ "is_docked"
+ " - {{ trigger.platform }}"
+ " - {{ trigger.event.event_type }}"
+ )
},
},
},
@@ -218,7 +226,11 @@ async def test_if_state_legacy(
"action": {
"service": "test.automation",
"data_template": {
- "some": "is_cleaning - {{ trigger.platform }} - {{ trigger.event.event_type }}"
+ "some": (
+ "is_cleaning"
+ " - {{ trigger.platform }}"
+ " - {{ trigger.event.event_type }}"
+ )
},
},
},
diff --git a/tests/components/vacuum/test_device_trigger.py b/tests/components/vacuum/test_device_trigger.py
index 7a51c7caee6..752a9d4a301 100644
--- a/tests/components/vacuum/test_device_trigger.py
+++ b/tests/components/vacuum/test_device_trigger.py
@@ -213,8 +213,9 @@ async def test_if_fires_on_state_change(
"data_template": {
"some": (
"cleaning - {{ trigger.platform}} - "
- "{{ trigger.entity_id}} - {{ trigger.from_state.state}} - "
- "{{ trigger.to_state.state}}"
+ "{{ trigger.entity_id}}"
+ " - {{ trigger.from_state.state}}"
+ " - {{ trigger.to_state.state}}"
)
},
},
@@ -232,8 +233,9 @@ async def test_if_fires_on_state_change(
"data_template": {
"some": (
"docked - {{ trigger.platform}} - "
- "{{ trigger.entity_id}} - {{ trigger.from_state.state}} - "
- "{{ trigger.to_state.state}}"
+ "{{ trigger.entity_id}}"
+ " - {{ trigger.from_state.state}}"
+ " - {{ trigger.to_state.state}}"
)
},
},
@@ -298,8 +300,9 @@ async def test_if_fires_on_state_change_legacy(
"data_template": {
"some": (
"cleaning - {{ trigger.platform}} - "
- "{{ trigger.entity_id}} - {{ trigger.from_state.state}} - "
- "{{ trigger.to_state.state}}"
+ "{{ trigger.entity_id}}"
+ " - {{ trigger.from_state.state}}"
+ " - {{ trigger.to_state.state}}"
)
},
},
diff --git a/tests/components/vacuum/test_init.py b/tests/components/vacuum/test_init.py
index 7a7a6cd9198..da54f96824e 100644
--- a/tests/components/vacuum/test_init.py
+++ b/tests/components/vacuum/test_init.py
@@ -627,7 +627,7 @@ async def test_vacuum_log_deprecated_battery_using_attr(
is_built_in: bool,
log_warnings: int,
) -> None:
- """Test incorrectly using _attr_battery_* attribute does log issue and raise repair."""
+ """Test _attr_battery_* attribute logs issue and raises repair."""
class MockLegacyVacuum(MockVacuum):
"""Mocked vacuum entity."""
diff --git a/tests/components/vacuum/test_trigger.py b/tests/components/vacuum/test_trigger.py
index e166c677493..74a58e2a3e6 100644
--- a/tests/components/vacuum/test_trigger.py
+++ b/tests/components/vacuum/test_trigger.py
@@ -117,7 +117,7 @@ async def test_vacuum_state_trigger_behavior_any(
trigger_options: dict[str, Any],
states: list[TriggerStateDescription],
) -> None:
- """Test that the vacuum state trigger fires when any vacuum state changes to a specific state."""
+ """Test vacuum state trigger fires when any vacuum changes to a specific state."""
await assert_trigger_behavior_any(
hass,
target_entities=target_vacuums,
@@ -175,7 +175,7 @@ async def test_vacuum_state_trigger_behavior_first(
trigger_options: dict[str, Any],
states: list[TriggerStateDescription],
) -> None:
- """Test that the vacuum state trigger fires when the first vacuum changes to a specific state."""
+ """Test vacuum state trigger fires when first vacuum changes to a specific state."""
await assert_trigger_behavior_first(
hass,
target_entities=target_vacuums,
@@ -233,7 +233,7 @@ async def test_vacuum_state_trigger_behavior_last(
trigger_options: dict[str, Any],
states: list[TriggerStateDescription],
) -> None:
- """Test that the vacuum state trigger fires when the last vacuum changes to a specific state."""
+ """Test vacuum state trigger fires when last vacuum changes to a specific state."""
await assert_trigger_behavior_last(
hass,
target_entities=target_vacuums,
diff --git a/tests/components/vallox/test_sensor.py b/tests/components/vallox/test_sensor.py
index dd8d8026d06..75de4162200 100644
--- a/tests/components/vallox/test_sensor.py
+++ b/tests/components/vallox/test_sensor.py
@@ -47,7 +47,7 @@ def _now_at_13():
async def test_remaining_time_for_filter_none_returned_from_vallox(
mock_entry: MockConfigEntry, hass: HomeAssistant, setup_fetch_metric_data_mock
) -> None:
- """Test that the remaining time for filter sensor returns 'unknown' when Vallox returns None."""
+ """Test remaining time for filter returns 'unknown' when Vallox returns None."""
class MockMetricData(MetricData):
@property
diff --git a/tests/components/valve/test_init.py b/tests/components/valve/test_init.py
index bc7d95d24e3..37022d530c9 100644
--- a/tests/components/valve/test_init.py
+++ b/tests/components/valve/test_init.py
@@ -254,7 +254,8 @@ async def test_services(
await call_service(hass, SERVICE_TOGGLE, ent2)
await hass.async_block_till_done()
- # entities should be in correct state depending on the SUPPORT_STOP feature and valve position
+ # entities should be in correct state depending on
+ # the SUPPORT_STOP feature and valve position
assert is_open(hass, ent1)
assert is_opening(hass, ent2, 0, True)
ent2.finish_movement()
@@ -265,7 +266,8 @@ async def test_services(
await call_service(hass, SERVICE_TOGGLE, ent2)
await hass.async_block_till_done()
- # entities should be in correct state depending on the SUPPORT_STOP feature and valve position
+ # entities should be in correct state depending on
+ # the SUPPORT_STOP feature and valve position
assert is_closed(hass, ent1)
assert not is_opening(hass, ent2)
assert not is_closed(hass, ent2, 100)
diff --git a/tests/components/valve/test_trigger.py b/tests/components/valve/test_trigger.py
index 7f8e498609f..d8f5814edc7 100644
--- a/tests/components/valve/test_trigger.py
+++ b/tests/components/valve/test_trigger.py
@@ -116,7 +116,7 @@ async def test_valve_state_trigger_behavior_any(
trigger_options: dict[str, Any] | None,
states: list[TriggerStateDescription],
) -> None:
- """Test that the valve state trigger fires when any valve state changes to a specific state."""
+ """Test valve state trigger fires when any valve changes to a specific state."""
await assert_trigger_behavior_any(
hass,
target_entities=target_valves,
@@ -145,7 +145,7 @@ async def test_valve_state_trigger_behavior_first(
trigger_options: dict[str, Any],
states: list[TriggerStateDescription],
) -> None:
- """Test that the valve state trigger fires when the first valve changes to a specific state."""
+ """Test valve state trigger fires when first valve changes to a specific state."""
await assert_trigger_behavior_first(
hass,
target_entities=target_valves,
@@ -174,7 +174,7 @@ async def test_valve_state_trigger_behavior_last(
trigger_options: dict[str, Any],
states: list[TriggerStateDescription],
) -> None:
- """Test that the valve state trigger fires when the last valve changes to a specific state."""
+ """Test valve state trigger fires when last valve changes to a specific state."""
await assert_trigger_behavior_last(
hass,
target_entities=target_valves,
diff --git a/tests/components/vegehub/test_config_flow.py b/tests/components/vegehub/test_config_flow.py
index 03a92b6a31e..856149d750e 100644
--- a/tests/components/vegehub/test_config_flow.py
+++ b/tests/components/vegehub/test_config_flow.py
@@ -73,7 +73,8 @@ async def test_user_flow_success(hass: HomeAssistant) -> None:
assert result["data"][CONF_DEVICE] is not None
assert result["data"][CONF_WEBHOOK_ID] is not None
- # Since this is user flow, there is no hostname, so hostname should be the IP address
+ # Since this is user flow, there is no hostname,
+ # so hostname should be the IP address
assert result["data"][CONF_HOST] == TEST_IP
assert result["result"].unique_id == TEST_SIMPLE_MAC
diff --git a/tests/components/velbus/conftest.py b/tests/components/velbus/conftest.py
index 2f040ad1fb9..12f61e451de 100644
--- a/tests/components/velbus/conftest.py
+++ b/tests/components/velbus/conftest.py
@@ -383,14 +383,16 @@ def mock_vlp_content():
False
-
+
VMBSIG
564D42534947FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0300010001000101FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
564D42534947FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF030001000100010100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
FFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
-
+
VMB4LEDPWM-20
4368616E6E656C2031FFFFFFFFFFFFFF4368616E6E656C2032FFFFFFFFFFFFFF4368616E6E656C2033FFFFFFFFFFFFFF4368616E6E656C2034FFFFFFFFFFFFFF000000750700160008001700082AF5ECE3E7DDDFDEE5E8F2FD071115181818171A1A1A150E02FFFF1027171A1C151B181A17171209FEF2EAE2E0DCE1DEE4EAF5010DFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000564D42344C454450574D2D3230FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0601FE873FFFFFFFFF7FFFFFFFFFBFFFFFFFFFFEFFFFFFFFBFFFFFFFFF7FFFFFFFFF3FFFFFFFFF00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000FFFFFFFF0601FE873FFFFFFFFF7FFFFFFFFFBFFFFFFFFFFEFFFFFFFFBFFFFFFFFF7FFFFFFFFF3FFFFFFFFF00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000FFFFFFFF0601FE873FFFFFFFFF7FFFFFFFFFBFFFFFFFFFFEFFFFFFFFBFFFFFFFFF7FFFFFFFFF3FFFFFFFFF00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000FFFFFFFF0601FE873FFFFFFFFF7FFFFFFFFFBFFFFFFFFFFEFFFFFFFFBFFFFFFFFF7FFFFFFFFF3FFFFFFFFF00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000FFFFFFFFFFFFFFFF
diff --git a/tests/components/velbus/test_init.py b/tests/components/velbus/test_init.py
index 246f2aa8c17..86742bfa480 100644
--- a/tests/components/velbus/test_init.py
+++ b/tests/components/velbus/test_init.py
@@ -38,7 +38,7 @@ async def test_setup_start_failed(
controller: MagicMock,
entity_registry: er.EntityRegistry,
) -> None:
- """Test the setup that fails during velbus start task, should result in no entries."""
+ """Test setup fails during velbus start task, should result in no entries."""
controller.return_value.start.side_effect = ConnectionError()
await init_integration(hass, config_entry)
assert config_entry.state is ConfigEntryState.LOADED
diff --git a/tests/components/velux/conftest.py b/tests/components/velux/conftest.py
index 55c5aba25b5..774aeb96f03 100644
--- a/tests/components/velux/conftest.py
+++ b/tests/components/velux/conftest.py
@@ -250,7 +250,8 @@ def mock_scene() -> AsyncMock:
return scene
-# Fixture to set up the integration for testing, needs platform fixture, to be defined in each test file
+# Fixture to set up the integration for testing, needs platform fixture,
+# to be defined in each test file
@pytest.fixture
async def setup_integration(
hass: HomeAssistant,
diff --git a/tests/components/velux/test_button.py b/tests/components/velux/test_button.py
index c02591c777e..edf34cfd9b1 100644
--- a/tests/components/velux/test_button.py
+++ b/tests/components/velux/test_button.py
@@ -103,7 +103,8 @@ async def test_button_press_failure(
# Press the button and expect HomeAssistantError
with pytest.raises(
HomeAssistantError,
- match="Failed to reboot gateway. Try again in a few moments or power cycle the device manually",
+ match="Failed to reboot gateway. Try again in a few moments"
+ " or power cycle the device manually",
):
await hass.services.async_call(
BUTTON_DOMAIN,
@@ -154,7 +155,8 @@ async def test_identify_button_press_failure(
# Press the button and expect HomeAssistantError
with pytest.raises(
HomeAssistantError,
- match='Failed to communicate with Velux device: ',
+ match="Failed to communicate with Velux device:"
+ ' ',
):
await hass.services.async_call(
BUTTON_DOMAIN,
diff --git a/tests/components/velux/test_cover.py b/tests/components/velux/test_cover.py
index 483fbca5593..9544b2377ec 100644
--- a/tests/components/velux/test_cover.py
+++ b/tests/components/velux/test_cover.py
@@ -509,7 +509,7 @@ async def test_dual_roller_shutter_unknown_position(
unknown_attr: str,
unknown_entity_id: str,
) -> None:
- """Each part falls back to unknown independently when only its position is unknown."""
+ """Each part falls back to unknown when only its position is unknown."""
all_entity_ids = {
"cover.test_dual_roller_shutter",
diff --git a/tests/components/velux/test_init.py b/tests/components/velux/test_init.py
index e9c28929629..1da1a31b48a 100644
--- a/tests/components/velux/test_init.py
+++ b/tests/components/velux/test_init.py
@@ -65,7 +65,7 @@ async def test_setup_retry_on_oserror_during_scenes(
async def test_setup_auth_error(
mock_config_entry: ConfigEntry, hass: HomeAssistant, mock_pyvlx: AsyncMock
) -> None:
- """Test that PyVLXException with auth message raises ConfigEntryAuthFailed and starts reauth flow."""
+ """Test PyVLXException with auth message raises ConfigEntryAuthFailed."""
mock_pyvlx.load_scenes.side_effect = PyVLXException(
"Login to KLF 200 failed, check credentials"
diff --git a/tests/components/velux/test_light.py b/tests/components/velux/test_light.py
index b7ef427f60d..56cc9ca67b0 100644
--- a/tests/components/velux/test_light.py
+++ b/tests/components/velux/test_light.py
@@ -68,7 +68,8 @@ async def test_light_device_association(
assert device_entry.name == mock_light.name
-# This test is not light specific, it just uses the light platform to test the base entity class.
+# This test is not light specific, it just uses the light platform
+# to test the base entity class.
async def test_entity_callbacks(
hass: HomeAssistant,
mock_config_entry: MockConfigEntry,
diff --git a/tests/components/velux/test_number.py b/tests/components/velux/test_number.py
index 1139bad322e..47648ef0c6a 100644
--- a/tests/components/velux/test_number.py
+++ b/tests/components/velux/test_number.py
@@ -115,7 +115,7 @@ async def test_set_invalid_value_fails(
hass: HomeAssistant,
mock_exterior_heating: AsyncMock,
) -> None:
- """Values outside the valid range raise ServiceValidationError and do not call set_intensity."""
+ """Values outside valid range raise ServiceValidationError."""
entity_id = get_number_entity_id(mock_exterior_heating)
with pytest.raises(ServiceValidationError):
diff --git a/tests/components/vesync/conftest.py b/tests/components/vesync/conftest.py
index 02dcb8cf4a0..8c9e14d0c9e 100644
--- a/tests/components/vesync/conftest.py
+++ b/tests/components/vesync/conftest.py
@@ -335,7 +335,7 @@ async def fan_config_entry(
async def switch_old_id_config_entry(
hass: HomeAssistant, aioclient_mock: AiohttpClientMocker, config
) -> MockConfigEntry:
- """Create a mock VeSync config entry for `switch` with the old unique ID approach."""
+ """Create a mock VeSync config entry for switch with old unique ID."""
entry = MockConfigEntry(
title="VeSync",
domain=DOMAIN,
diff --git a/tests/components/vesync/test_fan.py b/tests/components/vesync/test_fan.py
index 65505af4ee8..326729d1206 100644
--- a/tests/components/vesync/test_fan.py
+++ b/tests/components/vesync/test_fan.py
@@ -158,7 +158,7 @@ async def test_set_preset_mode(
preset_mode: str,
patch_target: str,
) -> None:
- """Test handling of value in set_preset_mode method. Does this via turn on as it increases test coverage."""
+ """Test set_preset_mode method via turn on for test coverage."""
# If VeSyncTowerFan.mode fails (returns False), then HomeAssistantError is raised
with (
diff --git a/tests/components/vesync/test_humidifier.py b/tests/components/vesync/test_humidifier.py
index bd3aa00e861..83145a7f0ca 100644
--- a/tests/components/vesync/test_humidifier.py
+++ b/tests/components/vesync/test_humidifier.py
@@ -102,7 +102,8 @@ async def test_humidifier_state_assert(
state = hass.states.get(ENTITY_HUMIDIFIER)
- # ATTR_HUMIDITY represents the target_humidity which comes from configuration.auto_target_humidity node
+ # ATTR_HUMIDITY represents the target_humidity which comes from
+ # configuration.auto_target_humidity node
assert state.attributes.get(ATTR_HUMIDITY) == 40
@@ -142,7 +143,8 @@ async def test_set_target_humidity(
) -> None:
"""Test handling of return value from VeSyncHumid200300S.set_humidity."""
- # If VeSyncHumid200300S.set_humidity fails (returns False), then HomeAssistantError is raised
+ # If VeSyncHumid200300S.set_humidity fails (returns False),
+ # then HomeAssistantError is raised
with (
expectation,
patch(
@@ -264,7 +266,8 @@ async def test_set_mode(
) -> None:
"""Test handling of value in set_mode method."""
- # If VeSyncHumid200300S.set_mode fails (returns False), then HomeAssistantError is raised
+ # If VeSyncHumid200300S.set_mode fails (returns False),
+ # then HomeAssistantError is raised
with (
expectation,
patch(
diff --git a/tests/components/victron_ble/test_sensor.py b/tests/components/victron_ble/test_sensor.py
index 4990dfa96a9..1c28e791cab 100644
--- a/tests/components/victron_ble/test_sensor.py
+++ b/tests/components/victron_ble/test_sensor.py
@@ -56,13 +56,25 @@ from tests.components.bluetooth import (
# These are real encrypted payloads using VICTRON_SOLAR_CHARGER_TOKEN.
SOLAR_CHARGER_ERROR_PAYLOADS = {
# ChargerError.NO_ERROR -> state "no_error"
- "no_error": "100242a0016207adceb37b605d7e0ee21b24df5c0404040410951e81ea42b0492e356ad5ed8f7eb7",
+ "no_error": (
+ "100242a0016207adceb37b605d7e0ee21b24df5c"
+ "0404040410951e81ea42b0492e356ad5ed8f7eb7"
+ ),
# ChargerError.INTERNAL_SUPPLY_A -> mapped to state "internal_supply"
- "internal_supply": "100242a0016207adce787b605d7e0ee21b24df5c0404040410951e81ea42b0492e356ad5ed8f7eb7",
+ "internal_supply": (
+ "100242a0016207adce787b605d7e0ee21b24df5c"
+ "0404040410951e81ea42b0492e356ad5ed8f7eb7"
+ ),
# ChargerError.VOLTAGE_HIGH -> state "voltage_high"
- "voltage_high": "100242a0016207adceb17b605d7e0ee21b24df5c0404040410951e81ea42b0492e356ad5ed8f7eb7",
+ "voltage_high": (
+ "100242a0016207adceb17b605d7e0ee21b24df5c"
+ "0404040410951e81ea42b0492e356ad5ed8f7eb7"
+ ),
# ChargerError.NETWORK_A -> mapped to state "network"
- "network": "100242a0016207adcef77b605d7e0ee21b24df5c0404040410951e81ea42b0492e356ad5ed8f7eb7",
+ "network": (
+ "100242a0016207adcef77b605d7e0ee21b24df5c"
+ "0404040410951e81ea42b0492e356ad5ed8f7eb7"
+ ),
}
diff --git a/tests/components/victron_gx/test_binary_sensor.py b/tests/components/victron_gx/test_binary_sensor.py
index 5200cc159ee..9cdb1ae515f 100644
--- a/tests/components/victron_gx/test_binary_sensor.py
+++ b/tests/components/victron_gx/test_binary_sensor.py
@@ -24,7 +24,7 @@ async def test_victron_binary_sensor(
entity_registry: er.EntityRegistry,
device_registry: dr.DeviceRegistry,
) -> None:
- """Test BINARY_SENSOR MetricKind - EV charger connected sensor is created and updated."""
+ """Test EV charger connected binary sensor is created and updated."""
victron_hub, mock_config_entry = init_integration
await inject_message(
diff --git a/tests/components/victron_gx/test_sensor.py b/tests/components/victron_gx/test_sensor.py
index 290f07a7be5..c2ac33d82b5 100644
--- a/tests/components/victron_gx/test_sensor.py
+++ b/tests/components/victron_gx/test_sensor.py
@@ -126,7 +126,7 @@ async def test_victron_main_topic_sensor(
init_integration: tuple[VictronVenusHub, MockConfigEntry],
entity_registry: er.EntityRegistry,
) -> None:
- """Test sensor whose metric has main_topic=True keeps translation key and uses device name."""
+ """Test sensor with main_topic=True keeps translation key and device name."""
victron_hub, mock_config_entry = init_integration
# Multi RS MPPT MppOperationMode is a main_topic metric
diff --git a/tests/components/victron_remote_monitoring/test_config_flow.py b/tests/components/victron_remote_monitoring/test_config_flow.py
index 610c288f4c2..8957c0c16b6 100644
--- a/tests/components/victron_remote_monitoring/test_config_flow.py
+++ b/tests/components/victron_remote_monitoring/test_config_flow.py
@@ -118,7 +118,8 @@ async def test_user_step_errors_then_success(
DOMAIN, context={"source": SOURCE_USER}
)
flow_id = result["flow_id"]
- # First call raises/returns error via side_effect, we then clear and set return value
+ # First call raises/returns error via side_effect,
+ # we then clear and set return value
mock_vrm_client.users.list_sites.side_effect = side_effect
result_err = await hass.config_entries.flow.async_configure(
flow_id, {CONF_API_TOKEN: "token"}
@@ -204,7 +205,7 @@ async def test_select_site_errors(
async def test_select_site_duplicate_aborts(
hass: HomeAssistant, mock_vrm_client: AsyncMock
) -> None:
- """Selecting an already configured site aborts during the select step (multi-site)."""
+ """Selecting already configured site aborts during select step."""
site_id = 555
# Existing entry with same site id
diff --git a/tests/components/victron_remote_monitoring/test_init.py b/tests/components/victron_remote_monitoring/test_init.py
index 33f2ce930a6..46052aa6d05 100644
--- a/tests/components/victron_remote_monitoring/test_init.py
+++ b/tests/components/victron_remote_monitoring/test_init.py
@@ -34,8 +34,10 @@ async def test_setup_auth_or_connection_error_starts_retry_or_reauth(
) -> None:
"""Auth errors initiate reauth flow; other errors set entry to retry.
- AuthenticationError should surface as ConfigEntryAuthFailed which marks the entry in SETUP_ERROR and starts a reauth flow.
- Generic VictronVRMError should set the entry to SETUP_RETRY without a reauth flow.
+ AuthenticationError should surface as ConfigEntryAuthFailed which marks
+ the entry in SETUP_ERROR and starts a reauth flow.
+ Generic VictronVRMError should set the entry to SETUP_RETRY
+ without a reauth flow.
"""
mock_config_entry.add_to_hass(hass)
# Override default success behaviour of fixture to raise side effect
diff --git a/tests/components/vizio/test_config_flow.py b/tests/components/vizio/test_config_flow.py
index 1e2d7fa7ff0..933647ca7c5 100644
--- a/tests/components/vizio/test_config_flow.py
+++ b/tests/components/vizio/test_config_flow.py
@@ -204,7 +204,7 @@ async def test_tv_options_flow_with_apps(hass: HomeAssistant) -> None:
@pytest.mark.usefixtures("vizio_connect", "vizio_bypass_update")
async def test_tv_options_flow_start_with_volume(hass: HomeAssistant) -> None:
- """Test options config flow for TV with providing apps option after providing volume step in initial config."""
+ """Test options flow for TV with apps option after volume step."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": SOURCE_USER}, data=MOCK_USER_VALID_TV_CONFIG
)
@@ -264,7 +264,7 @@ async def test_user_host_already_configured(hass: HomeAssistant) -> None:
@pytest.mark.usefixtures("vizio_connect", "vizio_bypass_setup")
async def test_user_serial_number_already_exists(hass: HomeAssistant) -> None:
- """Test serial_number is already configured with different host and name during user setup."""
+ """Test serial_number already configured with different host and name."""
# Set up new entry
MockConfigEntry(
domain=DOMAIN, data=MOCK_SPEAKER_CONFIG, unique_id=UNIQUE_ID
@@ -311,7 +311,7 @@ async def test_user_error_on_could_not_connect_invalid_token(
"vizio_connect", "vizio_bypass_setup", "vizio_complete_pairing"
)
async def test_user_tv_pairing_no_apps(hass: HomeAssistant) -> None:
- """Test pairing config flow when access token not provided for tv during user entry and no apps configured."""
+ """Test pairing flow when no access token for TV and no apps configured."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": SOURCE_USER}, data=MOCK_TV_CONFIG_NO_TOKEN
)
@@ -373,7 +373,7 @@ async def test_user_invalid_pin(hass: HomeAssistant) -> None:
@pytest.mark.usefixtures("vizio_connect", "vizio_bypass_setup")
async def test_user_ignore(hass: HomeAssistant) -> None:
- """Test user config flow doesn't throw an error when there's an existing ignored source."""
+ """Test user config flow with an existing ignored source."""
entry = MockConfigEntry(
domain=DOMAIN,
data=MOCK_SPEAKER_CONFIG,
@@ -501,7 +501,7 @@ async def test_zeroconf_dupe_fail(hass: HomeAssistant) -> None:
"vizio_connect", "vizio_bypass_setup", "vizio_guess_device_type"
)
async def test_zeroconf_ignore(hass: HomeAssistant) -> None:
- """Test zeroconf discovery doesn't throw an error when there's an existing ignored source."""
+ """Test zeroconf discovery with an existing ignored source."""
entry = MockConfigEntry(
domain=DOMAIN,
data=MOCK_SPEAKER_CONFIG,
@@ -561,7 +561,7 @@ async def test_zeroconf_abort_when_ignored(hass: HomeAssistant) -> None:
"vizio_guess_device_type",
)
async def test_zeroconf_flow_already_configured_hostname(hass: HomeAssistant) -> None:
- """Test entity is already configured during zeroconf setup when existing entry uses hostname."""
+ """Test already configured during zeroconf when entry uses hostname."""
config = MOCK_SPEAKER_CONFIG.copy()
config[CONF_HOST] = "hostname"
entry = MockConfigEntry(
diff --git a/tests/components/vizio/test_media_player.py b/tests/components/vizio/test_media_player.py
index d023bae0e4b..a8928ca06ef 100644
--- a/tests/components/vizio/test_media_player.py
+++ b/tests/components/vizio/test_media_player.py
@@ -125,7 +125,7 @@ def _get_ha_power_state(vizio_power_state: bool) -> str:
def _assert_sources_and_volume(attr: dict[str, Any], vizio_device_class: str) -> None:
- """Assert source list, source, and volume level based on attr dict and device class."""
+ """Assert source list, source, and volume level based on device class."""
assert attr[ATTR_INPUT_SOURCE_LIST] == INPUT_LIST
assert attr[ATTR_INPUT_SOURCE] == CURRENT_INPUT
assert (
@@ -151,7 +151,7 @@ def _get_attr_and_assert_base_attr(
async def _cm_for_test_setup_without_apps(
all_settings: dict[str, Any], vizio_power_state: bool
) -> AsyncIterator[None]:
- """Context manager to setup test for Vizio devices without including app specific patches."""
+ """Context manager to setup test for Vizio devices without app patches."""
with (
patch(
"homeassistant.components.vizio.VizioAsync.get_all_settings",
@@ -406,7 +406,8 @@ async def test_services(
"eq",
"Music",
)
- # Test that the update_setting service does config validation/transformation correctly
+ # Test that the update_setting service does config
+ # validation/transformation correctly
await _test_service(
hass,
DOMAIN,
@@ -716,7 +717,8 @@ async def test_apps_update(
await hass.async_block_till_done()
async_fire_time_changed(hass, dt_util.now() + timedelta(days=2))
await hass.async_block_till_done()
- # Check source list, remove TV inputs, and verify that the integration is
+ # Check source list, remove TV inputs, and verify that
+ # the integration is
# now using the APP_LIST list
sources = hass.states.get(ENTITY_ID).attributes[ATTR_INPUT_SOURCE_LIST]
apps = list(set(sources) - set(INPUT_LIST))
diff --git a/tests/components/vodafone_station/test_switch.py b/tests/components/vodafone_station/test_switch.py
index 5d34e01ffa5..7fe8e468c76 100644
--- a/tests/components/vodafone_station/test_switch.py
+++ b/tests/components/vodafone_station/test_switch.py
@@ -131,7 +131,9 @@ async def test_switch_fails(
SWITCH_DOMAIN,
SERVICE_TOGGLE,
{
- ATTR_ENTITY_ID: f"switch.vodafone_station_{TEST_SERIAL_NUMBER}_guest_5ghz_network"
+ ATTR_ENTITY_ID: (
+ f"switch.vodafone_station_{TEST_SERIAL_NUMBER}_guest_5ghz_network"
+ )
},
blocking=True,
)
diff --git a/tests/components/voip/conftest.py b/tests/components/voip/conftest.py
index 6993cab8c4f..6ca264c8962 100644
--- a/tests/components/voip/conftest.py
+++ b/tests/components/voip/conftest.py
@@ -68,7 +68,8 @@ def call_info() -> CallInfo:
"max-forwards": "70",
"user-agent": "Grandstream HT801 1.0.17.5",
"supported": "replaces, path, timer, eventlist",
- "allow": "INVITE, ACK, OPTIONS, CANCEL, BYE, SUBSCRIBE, NOTIFY, INFO, REFER, UPDATE",
+ "allow": "INVITE, ACK, OPTIONS, CANCEL, BYE,"
+ " SUBSCRIBE, NOTIFY, INFO, REFER, UPDATE",
"content-type": "application/sdp",
"accept": "application/sdp, application/dtmf-relay",
"content-length": "480",
diff --git a/tests/components/voip/test_voip.py b/tests/components/voip/test_voip.py
index a218bd67120..991132f970d 100644
--- a/tests/components/voip/test_voip.py
+++ b/tests/components/voip/test_voip.py
@@ -1120,7 +1120,8 @@ async def test_start_conversation_user_doesnt_pick_up(
& assist_satellite.AssistSatelliteEntityFeature.START_CONVERSATION
)
- # Protocol has already been mocked, but "outgoing_call" and "cancel_call" are not async
+ # Protocol has already been mocked, but "outgoing_call" and
+ # "cancel_call" are not async
mock_protocol: AsyncMock = hass.data[DOMAIN].protocol
mock_protocol.outgoing_call = Mock()
mock_protocol.cancel_call = Mock()
diff --git a/tests/components/volvo/test_services.py b/tests/components/volvo/test_services.py
index be254c0c872..5bd2d1f841f 100644
--- a/tests/components/volvo/test_services.py
+++ b/tests/components/volvo/test_services.py
@@ -193,7 +193,7 @@ async def test_async_image_does_not_exist(hass: HomeAssistant) -> None:
async def test_async_image_non_404_status_error(hass: HomeAssistant) -> None:
- """Test _async_image_exists raises HomeAssistantError on non-404 HTTP status errors."""
+ """Test _async_image_exists raises HomeAssistantError on non-404 errors."""
client = AsyncMock(spec=AsyncClient)
client.stream.side_effect = HTTPStatusError(
"Internal server error",
diff --git a/tests/components/waqi/test_init.py b/tests/components/waqi/test_init.py
index 0db2490d17a..a5c85b57e7a 100644
--- a/tests/components/waqi/test_init.py
+++ b/tests/components/waqi/test_init.py
@@ -150,13 +150,15 @@ async def test_migration_from_v1(
None,
[
{
- "sensor_entity_id": "sensor.not_de_jongweg_utrecht_air_quality_index",
+ "sensor_entity_id": (
+ "sensor.not_de_jongweg_utrecht_air_quality_index"
+ ),
"device_disabled_by": None,
"entity_disabled_by": None,
"device": 1,
},
{
- "sensor_entity_id": "sensor.de_jongweg_utrecht_air_quality_index",
+ "sensor_entity_id": ("sensor.de_jongweg_utrecht_air_quality_index"),
"device_disabled_by": DeviceEntryDisabler.USER,
"entity_disabled_by": RegistryEntryDisabler.DEVICE,
"device": 0,
@@ -169,13 +171,15 @@ async def test_migration_from_v1(
None,
[
{
- "sensor_entity_id": "sensor.de_jongweg_utrecht_air_quality_index",
+ "sensor_entity_id": ("sensor.de_jongweg_utrecht_air_quality_index"),
"device_disabled_by": DeviceEntryDisabler.USER,
"entity_disabled_by": RegistryEntryDisabler.DEVICE,
"device": 0,
},
{
- "sensor_entity_id": "sensor.not_de_jongweg_utrecht_air_quality_index",
+ "sensor_entity_id": (
+ "sensor.not_de_jongweg_utrecht_air_quality_index"
+ ),
"device_disabled_by": None,
"entity_disabled_by": None,
"device": 1,
@@ -188,13 +192,15 @@ async def test_migration_from_v1(
ConfigEntryDisabler.USER,
[
{
- "sensor_entity_id": "sensor.de_jongweg_utrecht_air_quality_index",
+ "sensor_entity_id": ("sensor.de_jongweg_utrecht_air_quality_index"),
"device_disabled_by": DeviceEntryDisabler.CONFIG_ENTRY,
"entity_disabled_by": RegistryEntryDisabler.CONFIG_ENTRY,
"device": 0,
},
{
- "sensor_entity_id": "sensor.not_de_jongweg_utrecht_air_quality_index",
+ "sensor_entity_id": (
+ "sensor.not_de_jongweg_utrecht_air_quality_index"
+ ),
"device_disabled_by": DeviceEntryDisabler.CONFIG_ENTRY,
"entity_disabled_by": None,
"device": 1,
diff --git a/tests/components/water_heater/test_trigger.py b/tests/components/water_heater/test_trigger.py
index e200f93b8a2..96863ed0643 100644
--- a/tests/components/water_heater/test_trigger.py
+++ b/tests/components/water_heater/test_trigger.py
@@ -165,7 +165,7 @@ async def test_water_heater_state_trigger_behavior_any(
trigger_options: dict[str, Any],
states: list[TriggerStateDescription],
) -> None:
- """Test that the water heater state trigger fires when any water heater state changes to a specific state."""
+ """Test water heater state trigger fires on any state change."""
await assert_trigger_behavior_any(
hass,
target_entities=target_water_heaters,
@@ -212,7 +212,7 @@ async def test_water_heater_state_attribute_trigger_behavior_any(
trigger_options: dict[str, Any],
states: list[TriggerStateDescription],
) -> None:
- """Test that the water heater target temperature attribute triggers fire when any water heater's target temperature changes or crosses a threshold."""
+ """Test water heater target temp trigger fires on threshold cross."""
await assert_trigger_behavior_any(
hass,
target_entities=target_water_heaters,
@@ -273,7 +273,7 @@ async def test_water_heater_state_trigger_behavior_first(
trigger_options: dict[str, Any],
states: list[TriggerStateDescription],
) -> None:
- """Test that the water heater state trigger fires when the first water heater changes to a specific state."""
+ """Test water heater state trigger fires on first entity change."""
await assert_trigger_behavior_first(
hass,
target_entities=target_water_heaters,
@@ -313,7 +313,7 @@ async def test_water_heater_state_attribute_trigger_behavior_first(
trigger_options: dict[str, Any],
states: list[tuple[tuple[str, dict], int]],
) -> None:
- """Test that the water heater attribute threshold trigger fires when the first water heater's target temperature crosses the configured threshold."""
+ """Test water heater temp trigger fires on first entity threshold."""
await assert_trigger_behavior_first(
hass,
target_entities=target_water_heaters,
@@ -374,7 +374,7 @@ async def test_water_heater_state_trigger_behavior_last(
trigger_options: dict[str, Any],
states: list[TriggerStateDescription],
) -> None:
- """Test that the water heater state trigger fires when the last water heater changes to a specific state."""
+ """Test water heater state trigger fires on last entity change."""
await assert_trigger_behavior_last(
hass,
target_entities=target_water_heaters,
@@ -414,7 +414,7 @@ async def test_water_heater_state_attribute_trigger_behavior_last(
trigger_options: dict[str, Any],
states: list[tuple[tuple[str, dict], int]],
) -> None:
- """Test that the water heater trigger fires when the last water heater's target temperature crosses the configured threshold."""
+ """Test water heater temp trigger fires on last entity threshold."""
await assert_trigger_behavior_last(
hass,
target_entities=target_water_heaters,
diff --git a/tests/components/waterfurnace/test_sensor.py b/tests/components/waterfurnace/test_sensor.py
index 389c295d1f1..0d2248f07a3 100644
--- a/tests/components/waterfurnace/test_sensor.py
+++ b/tests/components/waterfurnace/test_sensor.py
@@ -68,7 +68,7 @@ async def test_availability(
freezer: FrozenDateTimeFactory,
side_effect: Exception,
) -> None:
- """Ensure that we mark the entities unavailable correctly when service is offline."""
+ """Ensure entities are marked unavailable when service is offline."""
entity_id = "sensor.test_abc_type_total_power"
state = hass.states.get(entity_id)
diff --git a/tests/components/watergate/test_config_flow.py b/tests/components/watergate/test_config_flow.py
index 176047f5e23..6463126da84 100644
--- a/tests/components/watergate/test_config_flow.py
+++ b/tests/components/watergate/test_config_flow.py
@@ -52,7 +52,7 @@ async def test_step_user_form_with_exception(
client_result: AsyncMock,
mock_webhook_id_generation: Generator[None],
) -> None:
- """Test checking if errors will be displayed when Exception is thrown while checking device state."""
+ """Test errors are displayed when checking device state throws."""
mock_watergate_client.async_get_device_state = client_result
result = await hass.config_entries.flow.async_init(
diff --git a/tests/components/watts/test_climate.py b/tests/components/watts/test_climate.py
index a8194e9a4d4..c1fb846c06c 100644
--- a/tests/components/watts/test_climate.py
+++ b/tests/components/watts/test_climate.py
@@ -80,7 +80,7 @@ async def test_fast_polling(
mock_config_entry: MockConfigEntry,
freezer: FrozenDateTimeFactory,
) -> None:
- """Test that setting temperature triggers fast polling and it stops after duration."""
+ """Test setting temperature triggers fast polling that stops."""
await setup_integration(hass, mock_config_entry)
# Trigger fast polling
diff --git a/tests/components/weatherkit/test_coordinator.py b/tests/components/weatherkit/test_coordinator.py
index 7cc78179f44..e2403735f9a 100644
--- a/tests/components/weatherkit/test_coordinator.py
+++ b/tests/components/weatherkit/test_coordinator.py
@@ -18,7 +18,7 @@ async def test_update_uses_stale_data_before_threshold(
hass: HomeAssistant,
freezer: FrozenDateTimeFactory,
) -> None:
- """Test that stale data from the last successful update is used if an update failure occurs before the threshold."""
+ """Test stale data is used if update fails before threshold."""
with mock_weather_response():
await init_integration(hass)
@@ -47,7 +47,7 @@ async def test_update_becomes_unavailable_after_threshold(
hass: HomeAssistant,
freezer: FrozenDateTimeFactory,
) -> None:
- """Test that the entity becomes unavailable if an update failure occurs after the threshold."""
+ """Test entity becomes unavailable if update fails after threshold."""
with mock_weather_response():
await init_integration(hass)
@@ -70,7 +70,7 @@ async def test_update_recovers_after_failure(
hass: HomeAssistant,
freezer: FrozenDateTimeFactory,
) -> None:
- """Test that a successful update after repeated failures recovers the entity's state."""
+ """Test successful update after failures recovers entity state."""
with mock_weather_response():
await init_integration(hass)
diff --git a/tests/components/webostv/test_media_player.py b/tests/components/webostv/test_media_player.py
index 3175d197ab9..06d9a5880a6 100644
--- a/tests/components/webostv/test_media_player.py
+++ b/tests/components/webostv/test_media_player.py
@@ -528,17 +528,20 @@ async def test_client_key_update_on_connect(
(
True,
WebOsTvCommandError("Some error"),
- f"Communication error while calling async_media_play for device {TV_NAME}: Some error",
+ "Communication error while calling async_media_play"
+ f" for device {TV_NAME}: Some error",
),
(
True,
WebOsTvCommandError("Some other error"),
- f"Communication error while calling async_media_play for device {TV_NAME}: Some other error",
+ "Communication error while calling async_media_play"
+ f" for device {TV_NAME}: Some other error",
),
(
False,
None,
- f"Error calling async_media_play for device {TV_NAME}: Device is off and cannot be controlled",
+ f"Error calling async_media_play for device {TV_NAME}:"
+ " Device is off and cannot be controlled",
),
],
)
diff --git a/tests/components/webostv/test_notify.py b/tests/components/webostv/test_notify.py
index e64d58b8f91..f63500654eb 100644
--- a/tests/components/webostv/test_notify.py
+++ b/tests/components/webostv/test_notify.py
@@ -81,17 +81,20 @@ async def test_notify(hass: HomeAssistant, client) -> None:
(
True,
WebOsTvCommandError("Some error"),
- f"Communication error while sending notification to device {TV_NAME}: Some error",
+ "Communication error while sending notification to"
+ f" device {TV_NAME}: Some error",
),
(
True,
FileNotFoundError("Some other error"),
- f"Icon {ICON_PATH} not found when sending notification for device {TV_NAME}",
+ f"Icon {ICON_PATH} not found when sending notification"
+ f" for device {TV_NAME}",
),
(
False,
None,
- f"Error sending notification to device {TV_NAME}: Device is off and cannot be controlled",
+ f"Error sending notification to device {TV_NAME}:"
+ " Device is off and cannot be controlled",
),
],
)
diff --git a/tests/components/websocket_api/test_commands.py b/tests/components/websocket_api/test_commands.py
index 21801704f41..fbc3ce23c54 100644
--- a/tests/components/websocket_api/test_commands.py
+++ b/tests/components/websocket_api/test_commands.py
@@ -2269,7 +2269,9 @@ async def test_render_template_strict_with_timeout_and_error_2(
{
"type": "event",
"event": {
- "error": "TypeError: object of type 'datetime.datetime' has no len()",
+ "error": (
+ "TypeError: object of type 'datetime.datetime' has no len()"
+ ),
"level": "ERROR",
},
},
@@ -2277,7 +2279,9 @@ async def test_render_template_strict_with_timeout_and_error_2(
{
"type": "event",
"event": {
- "error": "TypeError: object of type 'datetime.datetime' has no len()",
+ "error": (
+ "TypeError: object of type 'datetime.datetime' has no len()"
+ ),
"level": "ERROR",
},
},
@@ -3564,7 +3568,8 @@ async def test_wait_integration_startup(
# Allow setup to proceed
setup_stall.set()
- # The component is scheduled to load, this will block until the config entry is loaded
+ # The component is scheduled to load, this will block until
+ # the config entry is loaded
await ws_client.send_json_auto_id({"type": "integration/wait", "domain": "test"})
response = await ws_client.receive_json()
assert response == {
@@ -3586,7 +3591,7 @@ async def test_extract_from_target(
entity_registry: er.EntityRegistry,
label_registry: lr.LabelRegistry,
) -> None:
- """Test extract_from_target command with mixed target types including entities, devices, areas, and labels."""
+ """Test extract_from_target command with mixed target types."""
async def call_command(target: dict[str, list[str]]) -> Any:
await websocket_client.send_json_auto_id(
@@ -3903,7 +3908,7 @@ async def test_get_triggers_conditions_for_target(
automation_component: str,
caplog: pytest.LogCaptureFixture,
) -> None:
- """Test get_triggers_for_target/get_conditions_for_target command with mixed target types."""
+ """Test get triggers/conditions for target with mixed types."""
async def async_get_triggers_conditions(hass: HomeAssistant) -> dict[str, type]:
return {
diff --git a/tests/components/websocket_api/test_connection.py b/tests/components/websocket_api/test_connection.py
index bbaf87907d0..4e63fc071fc 100644
--- a/tests/components/websocket_api/test_connection.py
+++ b/tests/components/websocket_api/test_connection.py
@@ -24,43 +24,55 @@ from tests.common import MockUser
exceptions.Unauthorized(),
websocket_api.ERR_UNAUTHORIZED,
"Unauthorized",
- "Error handling message: Unauthorized (unauthorized) Mock User from 127.0.0.42 (Browser)",
+ "Error handling message: Unauthorized (unauthorized)"
+ " Mock User from 127.0.0.42 (Browser)",
),
(
vol.Invalid("Invalid something"),
websocket_api.ERR_INVALID_FORMAT,
"Invalid something. Got {'id': 5}",
- "Error handling message: Invalid something. Got {'id': 5} (invalid_format) Mock User from 127.0.0.42 (Browser)",
+ "Error handling message: Invalid something."
+ " Got {'id': 5} (invalid_format)"
+ " Mock User from 127.0.0.42 (Browser)",
),
(
TimeoutError(),
websocket_api.ERR_TIMEOUT,
"Timeout",
- "Error handling message: Timeout (timeout) Mock User from 127.0.0.42 (Browser)",
+ "Error handling message: Timeout (timeout)"
+ " Mock User from 127.0.0.42 (Browser)",
),
(
exceptions.HomeAssistantError("Failed to do X"),
websocket_api.ERR_HOME_ASSISTANT_ERROR,
"Failed to do X",
- "Error handling message: Failed to do X (home_assistant_error) Mock User from 127.0.0.42 (Browser)",
+ "Error handling message: Failed to do X"
+ " (home_assistant_error)"
+ " Mock User from 127.0.0.42 (Browser)",
),
(
exceptions.ServiceValidationError("Failed to do X"),
websocket_api.ERR_HOME_ASSISTANT_ERROR,
"Failed to do X",
- "Error handling message: Failed to do X (home_assistant_error) Mock User from 127.0.0.42 (Browser)",
+ "Error handling message: Failed to do X"
+ " (home_assistant_error)"
+ " Mock User from 127.0.0.42 (Browser)",
),
(
ValueError("Really bad"),
websocket_api.ERR_UNKNOWN_ERROR,
"Unknown error",
- "Error handling message: Unknown error (unknown_error) Mock User from 127.0.0.42 (Browser)",
+ "Error handling message: Unknown error"
+ " (unknown_error)"
+ " Mock User from 127.0.0.42 (Browser)",
),
(
exceptions.HomeAssistantError,
websocket_api.ERR_UNKNOWN_ERROR,
"Unknown error",
- "Error handling message: Unknown error (unknown_error) Mock User from 127.0.0.42 (Browser)",
+ "Error handling message: Unknown error"
+ " (unknown_error)"
+ " Mock User from 127.0.0.42 (Browser)",
),
],
)
diff --git a/tests/components/websocket_api/test_messages.py b/tests/components/websocket_api/test_messages.py
index cb8a026fe0d..4632544e8d2 100644
--- a/tests/components/websocket_api/test_messages.py
+++ b/tests/components/websocket_api/test_messages.py
@@ -290,9 +290,9 @@ async def test_message_to_json_bytes(caplog: pytest.LogCaptureFixture) -> None:
json_str2 = message_to_json_bytes({"id": 1, "message": _Unserializeable()})
- assert (
- json_str2
- == b'{"id":1,"type":"result","success":false,"error":{"code":"unknown_error","message":"Invalid JSON in response"}}'
+ assert json_str2 == (
+ b'{"id":1,"type":"result","success":false,"error":'
+ b'{"code":"unknown_error","message":"Invalid JSON in response"}}'
)
assert "Unable to serialize to JSON" in caplog.text
diff --git a/tests/components/wemo/entity_test_helpers.py b/tests/components/wemo/entity_test_helpers.py
index 219f5c78f44..1b04cdd8901 100644
--- a/tests/components/wemo/entity_test_helpers.py
+++ b/tests/components/wemo/entity_test_helpers.py
@@ -97,12 +97,15 @@ async def _async_multiple_call_helper(
async def test_async_update_locked_callback_and_update(
- hass: HomeAssistant, pywemo_device: pywemo.WeMoDevice, wemo_entity: er.RegistryEntry
+ hass: HomeAssistant,
+ pywemo_device: pywemo.WeMoDevice,
+ wemo_entity: er.RegistryEntry,
) -> None:
- """Test that a callback and a state update request can't both happen at the same time.
+ """Test callback and state update can't both happen at once.
- When a state update is received via a callback from the device at the same time
- as hass is calling `async_update`, verify that only one of the updates proceeds.
+ When a state update is received via a callback from the device
+ at the same time as hass is calling `async_update`, verify that
+ only one of the updates proceeds.
"""
coordinator = async_get_coordinator(hass, wemo_entity.device_id)
await async_setup_component(hass, HA_DOMAIN, {})
@@ -174,7 +177,7 @@ class EntityTestHelpers:
pywemo_device: pywemo.WeMoDevice,
wemo_entity: er.RegistryEntry,
) -> None:
- """Test that two hass async_update state updates do not proceed at the same time."""
+ """Test two async_update state updates don't proceed simultaneously."""
await test_async_update_locked_multiple_updates(
hass, pywemo_device, wemo_entity
)
@@ -185,7 +188,7 @@ class EntityTestHelpers:
pywemo_device: pywemo.WeMoDevice,
wemo_entity: er.RegistryEntry,
) -> None:
- """Test that two device callback state updates do not proceed at the same time."""
+ """Test two device callback state updates don't proceed simultaneously."""
await test_async_update_locked_multiple_callbacks(
hass, pywemo_device, wemo_entity
)
@@ -196,10 +199,11 @@ class EntityTestHelpers:
pywemo_device: pywemo.WeMoDevice,
wemo_entity: er.RegistryEntry,
) -> None:
- """Test that a callback and a state update request can't both happen at the same time.
+ """Test callback and state update can't both happen at once.
- When a state update is received via a callback from the device at the same time
- as hass is calling `async_update`, verify that only one of the updates proceeds.
+ When a state update is received via a callback from the
+ device at the same time as hass is calling `async_update`,
+ verify that only one of the updates proceeds.
"""
await test_async_update_locked_callback_and_update(
hass, pywemo_device, wemo_entity
diff --git a/tests/components/wemo/test_init.py b/tests/components/wemo/test_init.py
index 4a38775d331..7b3053dc801 100644
--- a/tests/components/wemo/test_init.py
+++ b/tests/components/wemo/test_init.py
@@ -234,7 +234,8 @@ async def test_discovery(
mock_discover_statics.assert_called()
pywemo_devices.append(create_device(2))
- # Test that discovery runs periodically and the async_dispatcher_send code works.
+ # Test that discovery runs periodically and the
+ # async_dispatcher_send code works.
async_fire_time_changed(
hass,
dt_util.utcnow()
diff --git a/tests/components/wemo/test_light_bridge.py b/tests/components/wemo/test_light_bridge.py
index 4deddeaba94..c5062dd6984 100644
--- a/tests/components/wemo/test_light_bridge.py
+++ b/tests/components/wemo/test_light_bridge.py
@@ -48,7 +48,7 @@ def pywemo_bridge_light_fixture(pywemo_device):
async def test_async_update_locked_callback_and_update(
hass: HomeAssistant, pywemo_bridge_light, wemo_entity, pywemo_device
) -> None:
- """Test that a callback and a state update request can't both happen at the same time."""
+ """Test callback and state update can't both happen at once."""
await entity_test_helpers.test_async_update_locked_callback_and_update(
hass,
pywemo_device,
diff --git a/tests/components/whirlpool/test_init.py b/tests/components/whirlpool/test_init.py
index 2ea3cad5c14..f1400835700 100644
--- a/tests/components/whirlpool/test_init.py
+++ b/tests/components/whirlpool/test_init.py
@@ -36,7 +36,8 @@ async def test_setup_region_fallback(
) -> None:
"""Test setup when no region is available on the ConfigEntry.
- This can happen after a version update, since there was no region in the first versions.
+ This can happen after a version update, since there was no region
+ in the first versions.
"""
entry = MockConfigEntry(
@@ -59,7 +60,8 @@ async def test_setup_brand_fallback(
) -> None:
"""Test setup when no brand is available on the ConfigEntry.
- This can happen after a version update, since the brand was not selected or stored in the earlier versions.
+ This can happen after a version update, since the brand was not
+ selected or stored in the earlier versions.
"""
entry = MockConfigEntry(
diff --git a/tests/components/withings/test_init.py b/tests/components/withings/test_init.py
index bd0081a007b..f287d2ae0af 100644
--- a/tests/components/withings/test_init.py
+++ b/tests/components/withings/test_init.py
@@ -185,7 +185,9 @@ async def test_triggering_reauth(
"token": {"userid": 123},
"profile": "henk",
"use_webhook": False,
- "webhook_id": "3290798afaebd28519c4883d3d411c7197572e0cc9b8d507471f59a700a61a55",
+ "webhook_id": (
+ "3290798afaebd28519c4883d3d411c7197572e0cc9b8d507471f59a700a61a55"
+ ),
},
),
MockConfigEntry(
diff --git a/tests/components/wiz/test_config_flow.py b/tests/components/wiz/test_config_flow.py
index b58ba138f9f..f79abfd1069 100644
--- a/tests/components/wiz/test_config_flow.py
+++ b/tests/components/wiz/test_config_flow.py
@@ -499,7 +499,7 @@ async def test_setup_via_discovery_exception_finds_nothing(hass: HomeAssistant)
async def test_discovery_with_firmware_update(hass: HomeAssistant) -> None:
- """Test we check the device again between first discovery and config entry creation."""
+ """Test we recheck the device between discovery and entry creation."""
with _patch_wizlight(
device=None,
extended_white_range=FAKE_EXTENDED_WHITE_RANGE,
diff --git a/tests/components/wled/test_config_flow.py b/tests/components/wled/test_config_flow.py
index d43434a1e88..f4d3da1b571 100644
--- a/tests/components/wled/test_config_flow.py
+++ b/tests/components/wled/test_config_flow.py
@@ -105,7 +105,7 @@ async def test_full_reconfigure_flow_unique_id_mismatch(
async def test_full_reconfigure_flow_connection_error_and_success(
hass: HomeAssistant, mock_config_entry: MockConfigEntry, mock_wled: MagicMock
) -> None:
- """Test we show user form on WLED connection error and allows user to change host."""
+ """Test user form on WLED connection error allows host change."""
mock_config_entry.add_to_hass(hass)
# Mock connection error
diff --git a/tests/components/wmspro/test_config_flow.py b/tests/components/wmspro/test_config_flow.py
index 02132af4611..e6033ea54e8 100644
--- a/tests/components/wmspro/test_config_flow.py
+++ b/tests/components/wmspro/test_config_flow.py
@@ -170,7 +170,7 @@ async def test_config_flow_from_dhcp_no_update(
mock_setup_entry: AsyncMock,
mock_hub_refresh: AsyncMock,
) -> None:
- """Test we do not use DHCP discovery to overwrite hostname with IP in config entry."""
+ """Test DHCP discovery does not overwrite hostname with IP."""
info = DhcpServiceInfo(
ip="1.2.3.4", hostname="webcontrol", macaddress="001122334455"
)
diff --git a/tests/components/wsdot/conftest.py b/tests/components/wsdot/conftest.py
index c7614df7d91..41300090eb2 100644
--- a/tests/components/wsdot/conftest.py
+++ b/tests/components/wsdot/conftest.py
@@ -17,7 +17,7 @@ from tests.common import MockConfigEntry, load_json_object_fixture
@pytest.fixture
def mock_travel_time() -> Generator[AsyncMock]:
- """WsdotTravelTimes.get_travel_time is mocked to return a TravelTime data based on test fixture payload."""
+ """Mock get_travel_time to return TravelTime from fixture."""
with (
patch(
"homeassistant.components.wsdot.wsdot_api.WsdotTravelTimes", autospec=True
diff --git a/tests/components/wyoming/test_conversation.py b/tests/components/wyoming/test_conversation.py
index cd61caf87de..afead7c5a80 100644
--- a/tests/components/wyoming/test_conversation.py
+++ b/tests/components/wyoming/test_conversation.py
@@ -275,7 +275,7 @@ async def test_supported_languages_empty_means_all(
info_kwargs: dict,
agent_id: str,
) -> None:
- """Test that an empty list of supported languages means the agent supports all languages."""
+ """Test empty supported languages means agent supports all."""
config_entry: ConfigEntry = request.getfixturevalue(config_entry_fixture)
with (
diff --git a/tests/components/xiaomi_aqara/test_config_flow.py b/tests/components/xiaomi_aqara/test_config_flow.py
index eb5cf976cb8..c361c5b0c3c 100644
--- a/tests/components/xiaomi_aqara/test_config_flow.py
+++ b/tests/components/xiaomi_aqara/test_config_flow.py
@@ -122,7 +122,7 @@ async def test_config_flow_user_success(hass: HomeAssistant) -> None:
async def test_config_flow_user_multiple_success(hass: HomeAssistant) -> None:
- """Test a successful config flow initialized by the user with multiple gateways discovered."""
+ """Test successful config flow with multiple gateways discovered."""
result = await hass.config_entries.flow.async_init(
const.DOMAIN, context={"source": config_entries.SOURCE_USER}
)
@@ -211,7 +211,7 @@ async def test_config_flow_user_no_key_success(hass: HomeAssistant) -> None:
async def test_config_flow_user_host_mac_success(hass: HomeAssistant) -> None:
- """Test a successful config flow initialized by the user with a host and mac specified."""
+ """Test successful config flow with host and mac specified."""
result = await hass.config_entries.flow.async_init(
const.DOMAIN, context={"source": config_entries.SOURCE_USER}
)
diff --git a/tests/components/xiaomi_ble/__init__.py b/tests/components/xiaomi_ble/__init__.py
index d43c317e772..c37726146e5 100644
--- a/tests/components/xiaomi_ble/__init__.py
+++ b/tests/components/xiaomi_ble/__init__.py
@@ -117,7 +117,9 @@ MISCALE_V1_SERVICE_INFO = BluetoothServiceInfoBleak(
rssi=-60,
manufacturer_data={},
service_data={
- "0000181d-0000-1000-8000-00805f9b34fb": b"\x22\x9e\x43\xe5\x07\x04\x0b\x10\x13\x01"
+ "0000181d-0000-1000-8000-00805f9b34fb": (
+ b"\x22\x9e\x43\xe5\x07\x04\x0b\x10\x13\x01"
+ )
},
service_uuids=["0000181d-0000-1000-8000-00805f9b34fb"],
source="local",
@@ -134,7 +136,9 @@ MISCALE_V2_SERVICE_INFO = BluetoothServiceInfoBleak(
rssi=-60,
manufacturer_data={},
service_data={
- "0000181b-0000-1000-8000-00805f9b34fb": b"\x02&\xb2\x07\x05\x04\x0f\x02\x01\xac\x01\x86B"
+ "0000181b-0000-1000-8000-00805f9b34fb": (
+ b"\x02&\xb2\x07\x05\x04\x0f\x02\x01\xac\x01\x86B"
+ )
},
service_uuids=["0000181b-0000-1000-8000-00805f9b34fb"],
source="local",
diff --git a/tests/components/xiaomi_ble/test_binary_sensor.py b/tests/components/xiaomi_ble/test_binary_sensor.py
index e446a8fb66e..baf55808570 100644
--- a/tests/components/xiaomi_ble/test_binary_sensor.py
+++ b/tests/components/xiaomi_ble/test_binary_sensor.py
@@ -405,7 +405,7 @@ async def test_sleepy_device(hass: HomeAssistant) -> None:
async def test_sleepy_device_restore_state(hass: HomeAssistant) -> None:
- """Test sleepy device does not go to unavailable after 60 minutes and restores state."""
+ """Test sleepy device doesn't go unavailable and restores state."""
start_monotonic = time.monotonic()
entry = MockConfigEntry(
diff --git a/tests/components/xiaomi_ble/test_config_flow.py b/tests/components/xiaomi_ble/test_config_flow.py
index 3d8a4dab244..ebc1eae5c3e 100644
--- a/tests/components/xiaomi_ble/test_config_flow.py
+++ b/tests/components/xiaomi_ble/test_config_flow.py
@@ -80,7 +80,7 @@ async def test_async_step_bluetooth_valid_device_but_missing_payload(
async def test_async_step_bluetooth_valid_device_but_missing_payload_then_full(
hass: HomeAssistant,
) -> None:
- """Test discovering a valid device. Payload is too short, but later we get full one."""
+ """Test discovering a valid device with short then full payload."""
async def _async_process_advertisements(
_hass, _callback, _matcher, _mode, _timeout
@@ -175,7 +175,7 @@ async def test_async_step_bluetooth_valid_device_legacy_encryption(
async def test_async_step_bluetooth_valid_device_legacy_encryption_wrong_key(
hass: HomeAssistant,
) -> None:
- """Test discovery via bluetooth with a valid device, with legacy encryption and invalid key."""
+ """Test bluetooth discovery with legacy encryption and invalid key."""
result = await hass.config_entries.flow.async_init(
DOMAIN,
context={"source": config_entries.SOURCE_BLUETOOTH},
@@ -209,7 +209,7 @@ async def test_async_step_bluetooth_valid_device_legacy_encryption_wrong_key(
async def test_async_step_bluetooth_valid_device_legacy_encryption_wrong_key_length(
hass: HomeAssistant,
) -> None:
- """Test discovery via bluetooth with a valid device, with legacy encryption and wrong key length."""
+ """Test bluetooth discovery with legacy encryption and wrong key length."""
result = await hass.config_entries.flow.async_init(
DOMAIN,
context={"source": config_entries.SOURCE_BLUETOOTH},
@@ -310,7 +310,7 @@ async def test_bluetooth_discovery_device_v4_encryption_from_cloud(
async def test_bluetooth_discovery_device_v4_encryption_from_cloud_wrong_key(
hass: HomeAssistant,
) -> None:
- """Test discovery via bluetooth with a valid v4 device, with wrong auth from cloud."""
+ """Test bluetooth discovery with v4 device and wrong cloud auth."""
result = await hass.config_entries.flow.async_init(
DOMAIN,
context={"source": config_entries.SOURCE_BLUETOOTH},
@@ -492,7 +492,7 @@ async def test_bluetooth_discovery_cloud_offline(
async def test_async_step_bluetooth_valid_device_v4_encryption_wrong_key(
hass: HomeAssistant,
) -> None:
- """Test discovery via bluetooth with a valid device, with v4 encryption and wrong key."""
+ """Test bluetooth discovery with v4 encryption and wrong key."""
result = await hass.config_entries.flow.async_init(
DOMAIN,
context={"source": config_entries.SOURCE_BLUETOOTH},
@@ -533,7 +533,7 @@ async def test_async_step_bluetooth_valid_device_v4_encryption_wrong_key(
async def test_async_step_bluetooth_valid_device_v4_encryption_wrong_key_length(
hass: HomeAssistant,
) -> None:
- """Test discovery via bluetooth with a valid device, with v4 encryption and wrong key length."""
+ """Test bluetooth discovery with v4 encryption and wrong key length."""
result = await hass.config_entries.flow.async_init(
DOMAIN,
context={"source": config_entries.SOURCE_BLUETOOTH},
@@ -797,7 +797,7 @@ async def test_async_step_user_with_found_devices_v4_encryption(
async def test_async_step_user_with_found_devices_v4_encryption_wrong_key(
hass: HomeAssistant,
) -> None:
- """Test setup from service info cache with devices found, with v4 encryption and wrong key."""
+ """Test user setup with v4 encryption and wrong key."""
# Get a list of devices
with patch(
"homeassistant.components.xiaomi_ble.config_flow.async_discovered_service_info",
@@ -850,7 +850,7 @@ async def test_async_step_user_with_found_devices_v4_encryption_wrong_key(
async def test_async_step_user_with_found_devices_v4_encryption_wrong_key_length(
hass: HomeAssistant,
) -> None:
- """Test setup from service info cache with devices found, with v4 encryption and wrong key length."""
+ """Test user setup with v4 encryption and wrong key length."""
# Get a list of devices
with patch(
"homeassistant.components.xiaomi_ble.config_flow.async_discovered_service_info",
@@ -940,7 +940,7 @@ async def test_async_step_user_with_found_devices_legacy_encryption(
async def test_async_step_user_with_found_devices_legacy_encryption_wrong_key(
hass: HomeAssistant,
) -> None:
- """Test setup from service info cache with devices found, with legacy encryption and wrong key."""
+ """Test user setup with legacy encryption and wrong key."""
with patch(
"homeassistant.components.xiaomi_ble.config_flow.async_discovered_service_info",
return_value=[YLKG07YL_SERVICE_INFO],
@@ -985,7 +985,7 @@ async def test_async_step_user_with_found_devices_legacy_encryption_wrong_key(
async def test_async_step_user_with_found_devices_legacy_encryption_wrong_key_length(
hass: HomeAssistant,
) -> None:
- """Test setup from service info cache with devices found, with legacy encryption and wrong key length."""
+ """Test user setup with legacy encryption and wrong key length."""
with patch(
"homeassistant.components.xiaomi_ble.config_flow.async_discovered_service_info",
return_value=[YLKG07YL_SERVICE_INFO],
diff --git a/tests/components/xiaomi_ble/test_device_trigger.py b/tests/components/xiaomi_ble/test_device_trigger.py
index f415a968f25..2c0751bf56c 100644
--- a/tests/components/xiaomi_ble/test_device_trigger.py
+++ b/tests/components/xiaomi_ble/test_device_trigger.py
@@ -212,7 +212,7 @@ async def test_get_triggers_button(
async def test_get_triggers_double_button(
hass: HomeAssistant, device_registry: dr.DeviceRegistry
) -> None:
- """Test that we get the expected triggers from a Xiaomi BLE switch with 2 buttons."""
+ """Test expected triggers from a Xiaomi BLE switch with 2 buttons."""
mac = "DC:ED:83:87:12:73"
data = {"bindkey": "b93eb3787eabda352edd94b667f5d5a9"}
entry = await _async_setup_xiaomi_device(hass, mac, data)
@@ -253,7 +253,7 @@ async def test_get_triggers_double_button(
async def test_get_triggers_lock(
hass: HomeAssistant, device_registry: dr.DeviceRegistry
) -> None:
- """Test that we get the expected triggers from a Xiaomi BLE lock with fingerprint scanner."""
+ """Test expected triggers from a Xiaomi BLE lock with fingerprint."""
mac = "98:0C:33:A3:04:3D"
data = {"bindkey": "54d84797cb77f9538b224b305c877d1e"}
entry = await _async_setup_xiaomi_device(hass, mac, data)
@@ -667,7 +667,8 @@ async def test_automation_with_invalid_trigger_event_property(
},
)
await hass.async_block_till_done()
- # Logs should return message to make sure subtype is of one 'motion_detected' for motion event
+ # Logs should return message to make sure subtype is of one
+ # 'motion_detected' for motion event
assert "value must be one of ['motion_detected']" in caplog.text
assert await hass.config_entries.async_unload(entry.entry_id)
diff --git a/tests/components/xiaomi_ble/test_sensor.py b/tests/components/xiaomi_ble/test_sensor.py
index abfe140f6cb..d382dbaf8d0 100644
--- a/tests/components/xiaomi_ble/test_sensor.py
+++ b/tests/components/xiaomi_ble/test_sensor.py
@@ -293,7 +293,8 @@ async def test_xiaomi_hhccjcy01(hass: HomeAssistant) -> None:
async def test_xiaomi_hhccjcy01_not_connectable(hass: HomeAssistant) -> None:
"""Test HHCCJCY01 when sensors are not connectable.
- This device has multiple advertisements before all sensors are visible but not connectable.
+ This device has multiple advertisements before all sensors are
+ visible but not connectable.
"""
entry = MockConfigEntry(
domain=DOMAIN,
diff --git a/tests/components/yale/test_config_flow.py b/tests/components/yale/test_config_flow.py
index 09a15e31b78..fb7a0c495f5 100644
--- a/tests/components/yale/test_config_flow.py
+++ b/tests/components/yale/test_config_flow.py
@@ -218,7 +218,7 @@ async def test_reauth_wrong_account(
reauth_jwt_wrong_account: str,
jwt: str,
) -> None:
- """Test the reauthentication aborts, if user tries to reauthenticate with another account."""
+ """Test reauthentication aborts when using another account."""
assert mock_config_entry.data["token"]["access_token"] == jwt
mock_config_entry.add_to_hass(hass)
diff --git a/tests/components/yale/test_init.py b/tests/components/yale/test_init.py
index bd81e1d73bb..590ac2784c4 100644
--- a/tests/components/yale/test_init.py
+++ b/tests/components/yale/test_init.py
@@ -197,7 +197,7 @@ async def test_load_unload(hass: HomeAssistant) -> None:
async def test_load_triggers_ble_discovery(
hass: HomeAssistant, mock_discovery: Mock
) -> None:
- """Test that loading a lock that supports offline ble operation passes the keys to yalexe_ble."""
+ """Test loading a lock with offline BLE passes keys to yalexe_ble."""
yale_lock_with_key = await _mock_lock_with_offline_key(hass)
yale_lock_without_key = await _mock_operative_yale_lock_detail(hass)
diff --git a/tests/components/yale/test_lock.py b/tests/components/yale/test_lock.py
index 50051913d5f..ced5abcf20d 100644
--- a/tests/components/yale/test_lock.py
+++ b/tests/components/yale/test_lock.py
@@ -427,6 +427,8 @@ async def test_open_throws_hass_service_not_supported_error(
data = {ATTR_ENTITY_ID: entity_id}
with pytest.raises(
ServiceNotSupported,
- match=f"Entity {entity_id} does not support action {LOCK_DOMAIN}.{SERVICE_OPEN}",
+ match=(
+ f"Entity {entity_id} does not support action {LOCK_DOMAIN}.{SERVICE_OPEN}"
+ ),
):
await hass.services.async_call(LOCK_DOMAIN, SERVICE_OPEN, data, blocking=True)
diff --git a/tests/components/yalexs_ble/test_config_flow.py b/tests/components/yalexs_ble/test_config_flow.py
index 1c518b9ce33..ad716261a39 100644
--- a/tests/components/yalexs_ble/test_config_flow.py
+++ b/tests/components/yalexs_ble/test_config_flow.py
@@ -941,10 +941,10 @@ async def test_integration_discovery_takes_precedence_over_bluetooth_uuid_addres
assert len(flows) == 0
-async def test_integration_discovery_takes_precedence_over_bluetooth_non_unique_local_name(
+async def test_integration_discovery_precedence_over_bt_non_unique_name(
hass: HomeAssistant,
) -> None:
- """Test integration discovery dismisses bluetooth discovery with a non unique local name."""
+ """Test integration discovery dismisses non-unique BT discovery."""
result = await hass.config_entries.flow.async_init(
DOMAIN,
context={"source": config_entries.SOURCE_BLUETOOTH},
@@ -993,9 +993,10 @@ async def test_integration_discovery_takes_precedence_over_bluetooth_non_unique_
async def test_user_is_setting_up_lock_and_discovery_happens_in_the_middle(
hass: HomeAssistant,
) -> None:
- """Test that the user is setting up the lock and waiting for validation and the keys get discovered.
+ """Test user lock setup when discovery happens mid-validation.
- In this case the integration discovery should abort and let the user continue setting up the lock.
+ In this case the integration discovery should abort and let the
+ user continue setting up the lock.
"""
with patch(
"homeassistant.components.yalexs_ble.config_flow.async_discovered_service_info",
diff --git a/tests/components/yamaha_musiccast/test_config_flow.py b/tests/components/yamaha_musiccast/test_config_flow.py
index 51645dee49e..c04d3367c99 100644
--- a/tests/components/yamaha_musiccast/test_config_flow.py
+++ b/tests/components/yamaha_musiccast/test_config_flow.py
@@ -154,7 +154,7 @@ async def test_user_input_device_not_found(
async def test_user_input_non_yamaha_device_found(
hass: HomeAssistant, mock_get_device_info_invalid
) -> None:
- """Test when user specifies an existing device, which does not provide the musiccast API."""
+ """Test when device does not provide the musiccast API."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
@@ -196,7 +196,7 @@ async def test_user_input_device_already_existing(
async def test_user_input_unknown_error(
hass: HomeAssistant, mock_get_device_info_exception
) -> None:
- """Test when user specifies an existing device, which does not provide the musiccast API."""
+ """Test when device info raises an unknown error."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
@@ -241,7 +241,7 @@ async def test_user_input_device_found_no_ssdp(
mock_get_device_info_valid,
mock_empty_discovery_information,
) -> None:
- """Test when user specifies an existing device, which no discovery data are present for."""
+ """Test when no discovery data are present for the device."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
@@ -287,7 +287,7 @@ async def test_ssdp_discovery_failed(hass: HomeAssistant, mock_ssdp_no_yamaha) -
async def test_ssdp_discovery_successful_add_device(
hass: HomeAssistant, mock_ssdp_yamaha
) -> None:
- """Test when the SSDP discovered device is a musiccast device and the user confirms it."""
+ """Test SSDP discovered musiccast device is confirmed by user."""
result = await hass.config_entries.flow.async_init(
DOMAIN,
context={"source": config_entries.SOURCE_SSDP},
@@ -323,7 +323,7 @@ async def test_ssdp_discovery_successful_add_device(
async def test_ssdp_discovery_existing_device_update(
hass: HomeAssistant, mock_ssdp_yamaha
) -> None:
- """Test when the SSDP discovered device is a musiccast device, but it already exists with another IP."""
+ """Test SSDP discovered device already exists with another IP."""
mock_entry = MockConfigEntry(
domain=DOMAIN,
unique_id="1234567890",
diff --git a/tests/components/yeelight/test_config_flow.py b/tests/components/yeelight/test_config_flow.py
index a3f83cc03aa..ac53e4aeccb 100644
--- a/tests/components/yeelight/test_config_flow.py
+++ b/tests/components/yeelight/test_config_flow.py
@@ -674,7 +674,7 @@ async def test_discovered_by_dhcp_or_homekit(hass: HomeAssistant, source, data)
async def test_discovered_by_dhcp_or_homekit_failed_to_get_id(
hass: HomeAssistant, source, data
) -> None:
- """Test we abort if we cannot get the unique id when discovered from dhcp or homekit."""
+ """Test abort when unique id cannot be obtained from discovery."""
mocked_bulb = _mocked_bulb()
with (
diff --git a/tests/components/yeelight/test_init.py b/tests/components/yeelight/test_init.py
index 09064162eb0..ac2b79289b6 100644
--- a/tests/components/yeelight/test_init.py
+++ b/tests/components/yeelight/test_init.py
@@ -156,7 +156,7 @@ _ADAPTERS_WITH_MANUAL_CONFIG = [
async def test_setup_discovery_with_manually_configured_network_adapter(
hass: HomeAssistant,
) -> None:
- """Test setting up Yeelight by discovery with a manually configured network adapter."""
+ """Test Yeelight discovery with manual network adapter config."""
config_entry = MockConfigEntry(
domain=DOMAIN, data={CONF_HOST: IP_ADDRESS, **CONFIG_ENTRY_DATA}
)
@@ -214,7 +214,7 @@ _ADAPTERS_WITH_MANUAL_CONFIG_ONE_FAILING = [
async def test_setup_discovery_with_manually_configured_network_adapter_one_fails(
hass: HomeAssistant, caplog: pytest.LogCaptureFixture
) -> None:
- """Test setting up Yeelight by discovery with a manually configured network adapter with one that fails to bind."""
+ """Test Yeelight discovery with manual adapter when one fails to bind."""
config_entry = MockConfigEntry(
domain=DOMAIN, data={CONF_HOST: IP_ADDRESS, **CONFIG_ENTRY_DATA}
)
@@ -613,7 +613,7 @@ async def test_oserror_on_first_update_results_in_unavailable(
async def test_non_oserror_exception_on_first_update(
hass: HomeAssistant, exception: Exception
) -> None:
- """Test that an exceptions other than OSError on first update do not result in unavailable.
+ """Test non-OSError on first update does not result in unavailable.
The unavailable state will come as a push update in this case
"""
diff --git a/tests/components/yeelight/test_light.py b/tests/components/yeelight/test_light.py
index d5b4a521e5e..a2366be1b96 100644
--- a/tests/components/yeelight/test_light.py
+++ b/tests/components/yeelight/test_light.py
@@ -577,7 +577,7 @@ async def test_update_errors(
async def test_state_already_set_avoid_ratelimit(hass: HomeAssistant) -> None:
- """Ensure we suppress state changes that will increase the rate limit when there is no change."""
+ """Ensure we suppress no-op state changes to avoid rate limit."""
mocked_bulb = _mocked_bulb()
properties = {**PROPERTIES}
properties.pop("active_mode")
@@ -1216,7 +1216,7 @@ async def test_effects(hass: HomeAssistant) -> None:
async def test_ambilight_with_nightlight_disabled(hass: HomeAssistant) -> None:
- """Test that main light on ambilights with the nightlight disabled shows the correct brightness."""
+ """Test ambilight main light brightness with nightlight off."""
mocked_bulb = _mocked_bulb()
properties = {**PROPERTIES}
capabilities = {**CAPABILITIES}
@@ -1251,7 +1251,7 @@ async def test_ambilight_with_nightlight_disabled(hass: HomeAssistant) -> None:
async def test_state_fails_to_update_triggers_update(hass: HomeAssistant) -> None:
- """Ensure we call async_get_properties if the turn on/off fails to update the state."""
+ """Ensure async_get_properties is called on failed state update."""
mocked_bulb = _mocked_bulb()
properties = {**PROPERTIES}
properties.pop("active_mode")
diff --git a/tests/components/youtube/conftest.py b/tests/components/youtube/conftest.py
index d197133205c..52ef80c5d97 100644
--- a/tests/components/youtube/conftest.py
+++ b/tests/components/youtube/conftest.py
@@ -31,7 +31,10 @@ SCOPES = [
"https://www.googleapis.com/auth/youtube.readonly",
]
TITLE = "Google for Developers"
-TOKEN = "homeassistant.components.youtube.api.config_entry_oauth2_flow.OAuth2Session.async_ensure_token_valid"
+TOKEN = (
+ "homeassistant.components.youtube.api"
+ ".config_entry_oauth2_flow.OAuth2Session.async_ensure_token_valid"
+)
@pytest.fixture(name="scopes")
diff --git a/tests/components/youtube/test_config_flow.py b/tests/components/youtube/test_config_flow.py
index b52978368c0..be7085c9d42 100644
--- a/tests/components/youtube/test_config_flow.py
+++ b/tests/components/youtube/test_config_flow.py
@@ -176,7 +176,7 @@ async def test_flow_without_subscriptions(
hass: HomeAssistant,
hass_client_no_auth: ClientSessionGenerator,
) -> None:
- """Check flow continues even without subscriptions since user has their own channel."""
+ """Check flow continues without subscriptions using own channel."""
result = await hass.config_entries.flow.async_init(
"youtube", context={"source": config_entries.SOURCE_USER}
)
@@ -266,14 +266,26 @@ async def test_flow_http_error(
with patch(
"homeassistant.components.youtube.config_flow.YouTube.get_user_channels",
side_effect=ForbiddenError(
- "YouTube Data API v3 has not been used in project 0 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/youtube.googleapis.com/overview?project=0 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry."
+ "YouTube Data API v3 has not been used in project 0"
+ " before or it is disabled. Enable it by visiting"
+ " https://console.developers.google.com/apis/api/"
+ "youtube.googleapis.com/overview?project=0 then"
+ " retry. If you enabled this API recently, wait a"
+ " few minutes for the action to propagate to our"
+ " systems and retry."
),
):
result = await hass.config_entries.flow.async_configure(result["flow_id"])
assert result["type"] is FlowResultType.ABORT
assert result["reason"] == "access_not_configured"
assert result["description_placeholders"]["message"] == (
- "YouTube Data API v3 has not been used in project 0 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/youtube.googleapis.com/overview?project=0 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry."
+ "YouTube Data API v3 has not been used in project 0"
+ " before or it is disabled. Enable it by visiting"
+ " https://console.developers.google.com/apis/api/"
+ "youtube.googleapis.com/overview?project=0 then"
+ " retry. If you enabled this API recently, wait a"
+ " few minutes for the action to propagate to our"
+ " systems and retry."
)
@@ -447,7 +459,7 @@ async def test_own_channel_included(
hass: HomeAssistant,
hass_client_no_auth: ClientSessionGenerator,
) -> None:
- """Test that the user's own channel is included in the list of selectable channels."""
+ """Test user's own channel is included in selectable channels."""
result = await hass.config_entries.flow.async_init(
"youtube", context={"source": config_entries.SOURCE_USER}
)
diff --git a/tests/components/zeroconf/test_init.py b/tests/components/zeroconf/test_init.py
index 77811d1651b..80998a36330 100644
--- a/tests/components/zeroconf/test_init.py
+++ b/tests/components/zeroconf/test_init.py
@@ -220,15 +220,17 @@ async def test_setup_with_overly_long_url_and_name(
hass.config,
"location_name",
(
- "\u00dcBER \u00dcber German Umlaut long string long string long string long"
- " string long string long string long string long string long string long"
- " string long string long string long string long string long string long"
- " string long string long string long string long string long string long"
- " string long string long string long string long string long string long"
- " string long string long string long string long string long string long"
- " string long string long string long string long string long string long"
- " string long string long string long string long string long string long"
- " string long string long string long string long string"
+ "\u00dcBER \u00dcber German Umlaut long string"
+ " long string long string long string long string long string"
+ " long string long string long string long string long string"
+ " long string long string long string long string long string"
+ " long string long string long string long string long string"
+ " long string long string long string long string long string"
+ " long string long string long string long string long string"
+ " long string long string long string long string long string"
+ " long string long string long string long string long string"
+ " long string long string long string long string long string"
+ " long string long string long string long string"
),
),
patch(
diff --git a/tests/components/zeroconf/test_repairs.py b/tests/components/zeroconf/test_repairs.py
index d86b6285218..e24c296b0eb 100644
--- a/tests/components/zeroconf/test_repairs.py
+++ b/tests/components/zeroconf/test_repairs.py
@@ -69,7 +69,7 @@ def _get_hass_service_info_mock(
async def test_instance_id_conflict_creates_repair_issue_remove(
hass: HomeAssistant, issue_registry: ir.IssueRegistry
) -> None:
- """Test that a repair issue is created on instance ID conflict and gets removed when instance disappears."""
+ """Test repair issue on instance ID conflict removed on disappear."""
with (
patch("homeassistant.helpers.instance_id.async_get", return_value="abc123"),
patch.object(
@@ -115,7 +115,7 @@ async def test_instance_id_conflict_creates_repair_issue_remove(
async def test_instance_id_conflict_creates_repair_issue_changing_id(
hass: HomeAssistant, issue_registry: ir.IssueRegistry
) -> None:
- """Test that a repair issue is created on instance ID conflict and gets removed when instance ID changes."""
+ """Test repair issue on instance ID conflict removed on ID change."""
with (
patch("homeassistant.helpers.instance_id.async_get", return_value="abc123"),
patch.object(
@@ -170,7 +170,7 @@ async def test_instance_id_conflict_creates_repair_issue_changing_id(
async def test_instance_id_no_repair_issue_own_ip(
hass: HomeAssistant, issue_registry: ir.IssueRegistry
) -> None:
- """Test that no repair issue is created when the other instance ID matches our IP."""
+ """Test no repair issue when other instance ID matches our IP."""
with (
patch("homeassistant.helpers.instance_id.async_get", return_value="abc123"),
patch.object(discovery, "AsyncServiceBrowser", side_effect=service_update_mock),
diff --git a/tests/components/zha/common.py b/tests/components/zha/common.py
index 3935b66cc32..9191c6fa433 100644
--- a/tests/components/zha/common.py
+++ b/tests/components/zha/common.py
@@ -162,7 +162,10 @@ def find_entity_ids(
def async_find_group_entity_id(hass: HomeAssistant, domain, group):
"""Find the group entity id under test."""
- entity_id = f"{domain}.coordinator_manufacturer_coordinator_model_{group.name.lower().replace(' ', '_')}"
+ entity_id = (
+ f"{domain}.coordinator_manufacturer_coordinator_model"
+ f"_{group.name.lower().replace(' ', '_')}"
+ )
entity_ids = hass.states.async_entity_ids(domain)
assert entity_id in entity_ids
diff --git a/tests/components/zha/test_alarm_control_panel.py b/tests/components/zha/test_alarm_control_panel.py
index 184eaf3a4de..cda3d69ca93 100644
--- a/tests/components/zha/test_alarm_control_panel.py
+++ b/tests/components/zha/test_alarm_control_panel.py
@@ -29,7 +29,7 @@ from .conftest import SIG_EP_INPUT, SIG_EP_OUTPUT, SIG_EP_PROFILE, SIG_EP_TYPE
@pytest.fixture(autouse=True)
def alarm_control_panel_platform_only():
- """Only set up the alarm_control_panel and required base platforms to speed up tests."""
+ """Only set up alarm_control_panel and base platforms."""
with patch(
"homeassistant.components.zha.PLATFORMS",
(
diff --git a/tests/components/zha/test_config_flow.py b/tests/components/zha/test_config_flow.py
index 71f0923e009..7deb62b8496 100644
--- a/tests/components/zha/test_config_flow.py
+++ b/tests/components/zha/test_config_flow.py
@@ -476,7 +476,7 @@ async def test_legacy_zeroconf_discovery_ip_change_ignored(hass: HomeAssistant)
async def test_legacy_zeroconf_discovery_confirm_final_abort_if_entries(
hass: HomeAssistant,
) -> None:
- """Test discovery aborts if ZHA was set up after the confirmation dialog is shown."""
+ """Test discovery aborts if ZHA set up after confirmation shown."""
service_info = ZeroconfServiceInfo(
ip_address=ip_address("192.168.1.200"),
ip_addresses=[ip_address("192.168.1.200")],
@@ -793,7 +793,7 @@ async def test_multiple_zha_entries_aborts(hass: HomeAssistant, mock_app) -> Non
@patch("homeassistant.components.zha.async_setup_entry", AsyncMock(return_value=True))
async def test_discovery_via_usb_duplicate_unique_id(hass: HomeAssistant) -> None:
- """Test USB discovery when a config entry with a duplicate unique_id already exists."""
+ """Test USB discovery with duplicate unique_id config entry."""
entry = MockConfigEntry(
domain=DOMAIN,
@@ -1006,7 +1006,7 @@ async def test_legacy_zeroconf_discovery_already_setup(hass: HomeAssistant) -> N
async def test_zeroconf_discovery_via_socket_already_setup_with_ip_match(
hass: HomeAssistant,
) -> None:
- """Test zeroconf discovery aborting when ZHA is already setup with socket and one IP matches."""
+ """Test zeroconf aborts when ZHA uses socket with matching IP."""
MockConfigEntry(
domain=DOMAIN,
data={CONF_DEVICE: {CONF_DEVICE_PATH: "socket://192.168.1.101:6638"}},
@@ -2744,7 +2744,8 @@ async def test_probe_wrong_firmware_installed(hass: HomeAssistant) -> None:
context={CONF_SOURCE: "choose_serial_port"},
data={
CONF_DEVICE_PATH: (
- "/dev/ttyUSB1234 - Some serial port, s/n: 1234 - Virtual serial port"
+ "/dev/ttyUSB1234 - Some serial port,"
+ " s/n: 1234 - Virtual serial port"
)
},
)
@@ -2919,7 +2920,7 @@ async def test_formation_strategy_restore_manual_backup_overwrite_ieee_ezsp_writ
backup,
hass: HomeAssistant,
) -> None:
- """Test restoring a manual backup on EZSP coordinators (overwrite IEEE) with a write failure."""
+ """Test restoring manual backup on EZSP with a write failure."""
advanced_strategy_result = await advanced_pick_radio(RadioType.ezsp)
upload_backup_result = await hass.config_entries.flow.async_configure(
@@ -3064,11 +3065,13 @@ async def test_plug_in_new_radio_retry(
new_callable=DelayedAsyncMock,
side_effect=[
HomeAssistantError(
- "Failed to connect to Zigbee adapter: [Errno 2] No such file or directory"
+ "Failed to connect to Zigbee adapter:"
+ " [Errno 2] No such file or directory"
),
DestructiveWriteNetworkSettings("Radio IEEE change is permanent"),
HomeAssistantError(
- "Failed to connect to Zigbee adapter: [Errno 2] No such file or directory"
+ "Failed to connect to Zigbee adapter:"
+ " [Errno 2] No such file or directory"
),
None,
],
diff --git a/tests/components/zha/test_device_action.py b/tests/components/zha/test_device_action.py
index 92cba1ed279..d1bb4406ad0 100644
--- a/tests/components/zha/test_device_action.py
+++ b/tests/components/zha/test_device_action.py
@@ -30,7 +30,7 @@ COMMAND_SINGLE = "single"
@pytest.fixture(autouse=True)
def required_platforms_only():
- """Only set up the required platforms and required base platforms to speed up tests."""
+ """Only set up required platforms and base platforms."""
with patch(
"homeassistant.components.zha.PLATFORMS",
(
@@ -273,7 +273,8 @@ async def test_client_unique_id_suffix_stripped(
"platform": "event",
"event_type": "zha_event",
"event_data": {
- "unique_id": "38:5b:44:ff:fe:a7:cc:69:1:0x0006", # no `_CLIENT` suffix
+ # no `_CLIENT` suffix
+ "unique_id": "38:5b:44:ff:fe:a7:cc:69:1:0x0006",
"endpoint_id": 1,
"cluster_id": 6,
"command": "on",
diff --git a/tests/components/zha/test_device_tracker.py b/tests/components/zha/test_device_tracker.py
index df22eac5b6d..c5f89e95dc7 100644
--- a/tests/components/zha/test_device_tracker.py
+++ b/tests/components/zha/test_device_tracker.py
@@ -32,7 +32,7 @@ from tests.common import async_fire_time_changed
@pytest.fixture(autouse=True)
def device_tracker_platforms_only():
- """Only set up the device_tracker platforms and required base platforms to speed up tests."""
+ """Only set up device_tracker and base platforms."""
with patch(
"homeassistant.components.zha.PLATFORMS",
(
diff --git a/tests/components/zha/test_diagnostics.py b/tests/components/zha/test_diagnostics.py
index 65748a60661..55828532384 100644
--- a/tests/components/zha/test_diagnostics.py
+++ b/tests/components/zha/test_diagnostics.py
@@ -33,7 +33,7 @@ from tests.typing import ClientSessionGenerator
@pytest.fixture(autouse=True)
def required_platforms_only():
- """Only set up the required platform and required base platforms to speed up tests."""
+ """Only set up required platform and base platforms."""
with patch(
"homeassistant.components.zha.PLATFORMS", (Platform.ALARM_CONTROL_PANEL,)
):
diff --git a/tests/components/zha/test_init.py b/tests/components/zha/test_init.py
index 50a5db97100..d0ba212db3c 100644
--- a/tests/components/zha/test_init.py
+++ b/tests/components/zha/test_init.py
@@ -364,7 +364,7 @@ async def test_setup_firmware_update_in_progress_prevents_silabs_warning(
config_entry: MockConfigEntry,
mock_zigpy_connect: ControllerApplication,
) -> None:
- """Test firmware update in progress prevents silabs firmware warning on setup failure."""
+ """Test firmware update prevents silabs warning on setup failure."""
await async_setup_component(hass, HOMEASSISTANT_HARDWARE_DOMAIN, {})
config_entry.add_to_hass(hass)
diff --git a/tests/components/zha/test_light.py b/tests/components/zha/test_light.py
index 84772608e3b..d99cc87d111 100644
--- a/tests/components/zha/test_light.py
+++ b/tests/components/zha/test_light.py
@@ -199,7 +199,7 @@ async def test_on_with_off_color(
setup_zha: Callable[..., Coroutine[None]],
zigpy_device_mock: Callable[..., Device],
) -> None:
- """Test turning on the light and sending color commands before on/level commands for supporting lights."""
+ """Test color commands sent before on/level for supporting lights."""
await setup_zha()
gateway = get_zha_gateway(hass)
@@ -242,7 +242,8 @@ async def test_on_with_off_color(
dev1_cluster_on_off = zigpy_device.endpoints[1].on_off
dev1_cluster_level = zigpy_device.endpoints[1].level
- # Execute_if_off will override the "enhanced turn on from an off-state" config option that's enabled here
+ # Execute_if_off will override the "enhanced turn on from an
+ # off-state" config option that's enabled here
dev1_cluster_color.PLUGGED_ATTR_READS = {
"options": lighting.Color.Options.Execute_if_off
}
@@ -292,14 +293,17 @@ async def test_on_with_off_color(
assert light1_state.attributes["color_temp_kelvin"] == 4255
assert light1_state.attributes["color_mode"] == ColorMode.COLOR_TEMP
- # now let's turn off the Execute_if_off option and see if the old behavior is restored
+ # now let's turn off Execute_if_off and see if old behavior
+ # is restored
dev1_cluster_color.PLUGGED_ATTR_READS = {"options": 0}
update_attribute_cache(dev1_cluster_color)
- # turn off via UI, so the old "enhanced turn on from an off-state" behavior can do something
+ # turn off via UI, so the old "enhanced turn on from an
+ # off-state" behavior can do something
await async_test_off_from_hass(hass, dev1_cluster_on_off, device_1_entity_id)
- # turn on via UI (with a different color temp, so the "enhanced turn on" does something)
+ # turn on via UI (with a different color temp, so the
+ # "enhanced turn on" does something)
dev1_cluster_on_off.request.reset_mock()
dev1_cluster_level.request.reset_mock()
dev1_cluster_color.request.reset_mock()
diff --git a/tests/components/zha/test_logbook.py b/tests/components/zha/test_logbook.py
index c9a7998d188..4a4fc5caf54 100644
--- a/tests/components/zha/test_logbook.py
+++ b/tests/components/zha/test_logbook.py
@@ -274,8 +274,9 @@ async def test_zha_logbook_event_device_no_triggers(
assert events[4]["name"] == "FakeManufacturer FakeModel"
assert events[4]["domain"] == "zha"
assert (
- events[4]["message"]
- == "Attribute Updated event was fired with arguments: {'attribute_id': 1234, 'attribute_name': 'name', 'attribute_value': 'value'}"
+ events[4]["message"] == "Attribute Updated event was fired with arguments:"
+ " {'attribute_id': 1234, 'attribute_name': 'name',"
+ " 'attribute_value': 'value'}"
)
diff --git a/tests/components/zha/test_repairs.py b/tests/components/zha/test_repairs.py
index 372254d4ec3..02b7868694a 100644
--- a/tests/components/zha/test_repairs.py
+++ b/tests/components/zha/test_repairs.py
@@ -32,8 +32,14 @@ from homeassistant.setup import async_setup_component
from tests.common import MockConfigEntry
from tests.typing import ClientSessionGenerator
-SKYCONNECT_DEVICE = "/dev/serial/by-id/usb-Nabu_Casa_SkyConnect_v1.0_9e2adbd75b8beb119fe564a0f320645d-if00-port0"
-CONNECT_ZBT1_DEVICE = "/dev/serial/by-id/usb-Nabu_Casa_Home_Assistant_Connect_ZBT-1_3c0ed67c628beb11b1cd64a0f320645d-if00-port0"
+SKYCONNECT_DEVICE = (
+ "/dev/serial/by-id/usb-Nabu_Casa_SkyConnect_v1.0"
+ "_9e2adbd75b8beb119fe564a0f320645d-if00-port0"
+)
+CONNECT_ZBT1_DEVICE = (
+ "/dev/serial/by-id/usb-Nabu_Casa_Home_Assistant_Connect_ZBT-1"
+ "_3c0ed67c628beb11b1cd64a0f320645d-if00-port0"
+)
async def test_detect_radio_hardware(hass: HomeAssistant) -> None:
diff --git a/tests/components/zimi/test_config_flow.py b/tests/components/zimi/test_config_flow.py
index 7fbd3bbcfc3..55563ebb2d5 100644
--- a/tests/components/zimi/test_config_flow.py
+++ b/tests/components/zimi/test_config_flow.py
@@ -88,7 +88,7 @@ async def test_user_discovery_success_selection(
hass: HomeAssistant,
discovery_mock: MagicMock,
) -> None:
- """Test user form transitions via selection to creation if zcc discovery succeeds has multiple hosts."""
+ """Test user form to creation when discovery finds multiple hosts."""
discovery_mock.discovers.return_value = [
ControlPointDescription(host=INPUT_HOST, port=INPUT_PORT),
diff --git a/tests/components/zinvolt/const.py b/tests/components/zinvolt/const.py
index b61911baa29..6741de75505 100644
--- a/tests/components/zinvolt/const.py
+++ b/tests/components/zinvolt/const.py
@@ -1,3 +1,15 @@
"""Constants for the Zinvolt tests."""
-TOKEN = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOi8vZXZhLWJhY2tvZmZpY2Uub25tb29ubHkuYXBwL2FwaS9wdWJsaWMvdjIvbG9naW4iLCJpYXQiOjE3NjA3OTM0NjEsIm5iZiI6MTc2MDc5MzQ2MSwianRpIjoiYjY5U0J4bVVscU5WcmlKQyIsInN1YiI6ImEwMjI2YjhmLTk4ZmUtNDUyNC1iMzY5LTI3MmI0NjZiODc5NyIsInBydiI6IjIzYmQ1Yzg5NDlmNjAwYWRiMzllNzAxYzQwMDg3MmRiN2E1OTc2ZjciLCJkZXZpY2VzIjpbeyJzZXJpYWxfbnVtYmVyIjoiQUxHMDAxMTI0MTAwMTA3Iiwic3VwcGxpZXIiOiJhbHBoYWVzcyIsImRldmljZWFibGVfdHlwZSI6IkFwcFxcTW9kZWxzXFxCYWxjb255QmF0dGVyeSJ9XSwibmFtZSI6IkludGVncmF0aW9uIE5hbWUiLCJhYmlsaXRpZXMiOlsiYXBpOnB1YmxpYyJdfQ.UumLlVUkGBHnO0ZVtpfENy-edf_d5LV4gOctNan2M5w"
+TOKEN = (
+ "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9."
+ "eyJpc3MiOiJodHRwOi8vZXZhLWJhY2tvZmZpY2Uub25tb29ubHkuYXBwL2Fwa"
+ "S9wdWJsaWMvdjIvbG9naW4iLCJpYXQiOjE3NjA3OTM0NjEsIm5iZiI6MTc2MD"
+ "c5MzQ2MSwianRpIjoiYjY5U0J4bVVscU5WcmlKQyIsInN1YiI6ImEwMjI2Yjhm"
+ "LTk4ZmUtNDUyNC1iMzY5LTI3MmI0NjZiODc5NyIsInBydiI6IjIzYmQ1Yzg5ND"
+ "lmNjAwYWRiMzllNzAxYzQwMDg3MmRiN2E1OTc2ZjciLCJkZXZpY2VzIjpbeyJz"
+ "ZXJpYWxfbnVtYmVyIjoiQUxHMDAxMTI0MTAwMTA3Iiwic3VwcGxpZXIiOiJhbH"
+ "BoYWVzcyIsImRldmljZWFibGVfdHlwZSI6IkFwcFxcTW9kZWxzXFxCYWxjb255Q"
+ "mF0dGVyeSJ9XSwibmFtZSI6IkludGVncmF0aW9uIE5hbWUiLCJhYmlsaXRpZX"
+ "MiOlsiYXBpOnB1YmxpYyJdfQ."
+ "UumLlVUkGBHnO0ZVtpfENy-edf_d5LV4gOctNan2M5w"
+)
diff --git a/tests/components/zwave_js/conftest.py b/tests/components/zwave_js/conftest.py
index bf683596437..d7916ddd87a 100644
--- a/tests/components/zwave_js/conftest.py
+++ b/tests/components/zwave_js/conftest.py
@@ -400,12 +400,13 @@ def climate_radio_thermostat_ct101_multiple_temp_units_state_fixture() -> dict[
),
scope="package",
)
-def climate_radio_thermostat_ct100_mode_and_setpoint_on_different_endpoints_state_fixture() -> (
- dict[str, Any]
-):
- """Load climate device w/ mode+setpoint on diff endpoints node state fixture data."""
+def climate_radio_thermostat_ct100_mode_setpoint_diff_endpoints_state_fixture() -> dict[
+ str, Any
+]:
+ """Load climate with mode+setpoint on different endpoints."""
return load_json_object_fixture(
- "climate_radio_thermostat_ct100_mode_and_setpoint_on_different_endpoints_state.json",
+ "climate_radio_thermostat_ct100_mode_and_setpoint"
+ "_on_different_endpoints_state.json",
DOMAIN,
)
@@ -540,7 +541,7 @@ def basic_cc_sensor_state_fixture() -> dict[str, Any]:
@pytest.fixture(name="window_covering_outbound_bottom_state", scope="package")
def window_covering_outbound_bottom_state_fixture() -> dict[str, Any]:
- """Load node with Window Covering CC fixture data, with only the outbound bottom position supported."""
+ """Load node with Window Covering CC and outbound bottom only."""
return load_json_object_fixture("window_covering_outbound_bottom.json", DOMAIN)
@@ -1445,7 +1446,7 @@ def basic_cc_sensor_fixture(client, basic_cc_sensor_state) -> Node:
def window_covering_outbound_bottom_fixture(
client, window_covering_outbound_bottom_state
) -> Node:
- """Load node with Window Covering CC fixture data, with only the outbound bottom position supported."""
+ """Load node with Window Covering CC and outbound bottom only."""
node = Node(client, copy.deepcopy(window_covering_outbound_bottom_state))
client.driver.controller.nodes[node.node_id] = node
return node
diff --git a/tests/components/zwave_js/test_api.py b/tests/components/zwave_js/test_api.py
index 1e672c1e57e..7269e245037 100644
--- a/tests/components/zwave_js/test_api.py
+++ b/tests/components/zwave_js/test_api.py
@@ -518,7 +518,10 @@ async def test_node_alerts(
assert len(msg["result"]["comments"]) == 2
assert msg["result"]["comments"][1] == {
"level": "warning",
- "text": "This device is currently being interviewed and may not be fully operational.",
+ "text": (
+ "This device is currently being interviewed"
+ " and may not be fully operational."
+ ),
}
# Test with provisioned device
@@ -564,7 +567,10 @@ async def test_node_alerts(
assert msg["result"]["comments"] == [
{
"level": "info",
- "text": "This device has been provisioned but is not yet included in the network.",
+ "text": (
+ "This device has been provisioned but is"
+ " not yet included in the network."
+ ),
}
]
@@ -2551,7 +2557,7 @@ async def test_subscribe_rebuild_routes_progress_initial_value(
nortek_thermostat,
hass_ws_client: WebSocketGenerator,
) -> None:
- """Test subscribe_rebuild_routes_progress command when rebuild routes in progress."""
+ """Test subscribe_rebuild_routes_progress when in progress."""
entry = integration
ws_client = await hass_ws_client(hass)
diff --git a/tests/components/zwave_js/test_binary_sensor.py b/tests/components/zwave_js/test_binary_sensor.py
index dd8001d4cfd..1cd26e71414 100644
--- a/tests/components/zwave_js/test_binary_sensor.py
+++ b/tests/components/zwave_js/test_binary_sensor.py
@@ -76,7 +76,7 @@ def _add_door_tilt_state_value(node_state: dict[str, Any]) -> dict[str, Any]:
def _add_barrier_status_value(node_state: dict[str, Any]) -> dict[str, Any]:
- """Return a node state with a Barrier status Access Control notification value added."""
+ """Return node state with Barrier status notification added."""
updated_state = copy.deepcopy(node_state)
updated_state["values"].append(
{
@@ -112,7 +112,7 @@ def _add_barrier_status_value(node_state: dict[str, Any]) -> dict[str, Any]:
def _move_notification_values_to_endpoint(
node_state: dict[str, Any], endpoint: int
) -> dict[str, Any]:
- """Return a node state with all Notification CC values moved to a different endpoint."""
+ """Return node state with Notification CC values on new endpoint."""
updated_state = copy.deepcopy(node_state)
for value_data in updated_state["values"]:
if value_data.get("commandClass") == 113:
@@ -288,7 +288,8 @@ async def test_disabled_legacy_sensor(
hass: HomeAssistant, entity_registry: er.EntityRegistry, multisensor_6, integration
) -> None:
"""Test disabled legacy boolean binary sensor."""
- # this node has Notification CC implemented so legacy binary sensor should be disabled
+ # this node has Notification CC implemented so legacy binary
+ # sensor should be disabled
entity_id = DISABLED_LEGACY_BINARY_SENSOR
state = hass.states.get(entity_id)
@@ -906,7 +907,7 @@ async def test_access_control_lock_state_notification_sensors(
client,
lock_august_asl03_state,
) -> None:
- """Test Access Control lock state notification sensors from new discovery schemas."""
+ """Test Access Control lock state notification from new schemas."""
node = Node(client, _add_lock_state_notification_states(lock_august_asl03_state))
client.driver.controller.nodes[node.node_id] = node
@@ -944,7 +945,7 @@ async def test_access_control_catch_all_with_opening_state_present(
client,
hoppe_ehandle_connectsense_state,
) -> None:
- """Test that unrelated Access Control values are discovered even when Opening state is present."""
+ """Test unrelated Access Control values found with Opening state."""
node = Node(
client,
_add_barrier_status_value(hoppe_ehandle_connectsense_state),
@@ -967,7 +968,8 @@ async def test_access_control_catch_all_with_opening_state_present(
and "barrier" in reg_entry.original_name.lower()
]
assert len(barrier_entries) == 2, (
- f"Expected 2 barrier status sensors, got {[e.original_name for e in barrier_entries]}"
+ "Expected 2 barrier status sensors, got"
+ f" {[e.original_name for e in barrier_entries]}"
)
for reg_entry in barrier_entries:
state = hass.states.get(reg_entry.entity_id)
diff --git a/tests/components/zwave_js/test_config_flow.py b/tests/components/zwave_js/test_config_flow.py
index cd61d58d05d..85b0e2c5419 100644
--- a/tests/components/zwave_js/test_config_flow.py
+++ b/tests/components/zwave_js/test_config_flow.py
@@ -1442,7 +1442,7 @@ async def test_esphome_discovery_already_configured_unmanaged_addon(
addon_options: dict[str, Any],
stop_addon: AsyncMock,
) -> None:
- """Test ESPHome discovery aborts when home ID already configured with unmanaged add-on."""
+ """Test ESPHome discovery aborts when home ID already configured."""
addon_options[CONF_ADDON_SOCKET] = "esphome://existing-device:6053"
addon_options["another_key"] = "should_not_be_touched"
@@ -3412,7 +3412,7 @@ async def test_reconfigure_addon_running_no_changes(
form_data: dict[str, Any],
new_addon_options: dict[str, Any],
) -> None:
- """Test reconfigure flow without changes, and add-on already running on Supervisor."""
+ """Test reconfigure flow without changes, add-on running."""
addon_options.update(old_addon_options)
entry = integration
data = {**entry.data, **entry_data}
@@ -4899,7 +4899,7 @@ async def test_configure_addon_usb_ports_failure(
async def test_get_usb_ports_filtering(hass: HomeAssistant) -> None:
- """Test that get_usb_ports filters out 'n/a' descriptions when other ports are available."""
+ """Test get_usb_ports filters out 'n/a' when others exist."""
mock_ports = [
USBDevice(
device="/dev/ttyUSB0",
@@ -4951,7 +4951,7 @@ async def test_get_usb_ports_filtering(hass: HomeAssistant) -> None:
async def test_get_usb_ports_all_na(hass: HomeAssistant) -> None:
- """Test that get_usb_ports returns all ports as-is when only 'n/a' descriptions exist."""
+ """Test get_usb_ports returns all when only 'n/a' descriptions."""
mock_ports = [
USBDevice(
device="/dev/ttyUSB0",
@@ -4999,7 +4999,7 @@ async def test_get_usb_ports_all_na(hass: HomeAssistant) -> None:
async def test_get_usb_ports_mixed_case_filtering(hass: HomeAssistant) -> None:
- """Test that get_usb_ports filters out 'n/a' descriptions with different case variations."""
+ """Test get_usb_ports filters 'n/a' case-insensitively."""
mock_ports = [
USBDevice(
device="/dev/ttyUSB0",
@@ -5051,7 +5051,8 @@ async def test_get_usb_ports_mixed_case_filtering(hass: HomeAssistant) -> None:
descriptions = list(result.values())
- # Verify that only non-"n/a" descriptions are returned (case-insensitive filtering)
+ # Verify only non-"n/a" descriptions are returned
+ # (case-insensitive filtering)
assert descriptions == [
"Device A - /dev/ttyUSB1, s/n: n/a - 1234:5678",
"Device B - /dev/ttyUSB4, s/n: n/a - 1234:5678",
@@ -5071,7 +5072,7 @@ async def test_get_usb_ports_empty_list(hass: HomeAssistant) -> None:
async def test_get_usb_ports_single_na_port(hass: HomeAssistant) -> None:
- """Test that get_usb_ports returns single 'n/a' port when it's the only one available."""
+ """Test get_usb_ports returns single 'n/a' port when alone."""
mock_ports = [
USBDevice(
device="/dev/ttyUSB0",
@@ -5190,7 +5191,8 @@ async def test_get_usb_ports_ignored_devices(hass: HomeAssistant) -> None:
assert descriptions == [
"ZWA-2 - /dev/ttyUSB3, s/n: n/a - Nabu Casa - 10C4:EA60",
- "Z-Wave USB Adapter - /dev/ttyUSB4, s/n: n/a - Another Manufacturer - 10C4:EA60",
+ "Z-Wave USB Adapter - /dev/ttyUSB4, s/n: n/a"
+ " - Another Manufacturer - 10C4:EA60",
"/dev/ttyUSB5, s/n: n/a - 10C4:EA60",
]
diff --git a/tests/components/zwave_js/test_cover.py b/tests/components/zwave_js/test_cover.py
index 1d439d6a39f..89538c62841 100644
--- a/tests/components/zwave_js/test_cover.py
+++ b/tests/components/zwave_js/test_cover.py
@@ -581,7 +581,7 @@ async def test_aeotec_nano_shutter_cover(
aeotec_nano_shutter: Node,
integration: MockConfigEntry,
) -> None:
- """Test movement of an Aeotec Nano Shutter cover entity. Useful to make sure the stop command logic is handled properly."""
+ """Test Aeotec Nano Shutter cover entity stop command logic."""
node = aeotec_nano_shutter
state = hass.states.get(AEOTEC_SHUTTER_COVER_ENTITY)
@@ -1523,7 +1523,7 @@ async def test_multilevel_switch_cover_moving_state_set_position(
chain_actuator_zws12: Node,
integration: MockConfigEntry,
) -> None:
- """Test moving state direction with set_cover_position on Multilevel Switch cover."""
+ """Test moving direction with set_cover_position on ML Switch."""
node = chain_actuator_zws12
# First set position to 50 (open)
@@ -1677,7 +1677,7 @@ async def test_multilevel_switch_cover_moving_state_none_result(
chain_actuator_zws12: Node,
integration: MockConfigEntry,
) -> None:
- """Test None result (node asleep) does not set moving state on Multilevel Switch cover."""
+ """Test None result (asleep) doesn't set moving on ML Switch."""
state = hass.states.get(WINDOW_COVER_ENTITY)
assert state
assert state.state == CoverState.CLOSED
@@ -1704,7 +1704,7 @@ async def test_multilevel_switch_cover_v3_no_moving_state_supervised(
chain_actuator_zws12_state: dict[str, Any],
integration: MockConfigEntry,
) -> None:
- """Test v3 Multilevel Switch cover never sets OPENING/CLOSING even with Supervision."""
+ """Test v3 ML Switch cover never sets OPENING/CLOSING with SV."""
node_state = copy.deepcopy(chain_actuator_zws12_state)
for value in node_state["values"]:
if value["commandClass"] == CommandClass.SWITCH_MULTILEVEL:
@@ -1815,7 +1815,7 @@ async def test_multilevel_switch_cover_v3_no_moving_state_unsupervised(
chain_actuator_zws12_state: dict[str, Any],
integration: MockConfigEntry,
) -> None:
- """Test v3 Multilevel Switch cover never sets OPENING/CLOSING without Supervision."""
+ """Test v3 ML Switch never sets OPENING/CLOSING without SV."""
node_state = copy.deepcopy(chain_actuator_zws12_state)
for value in node_state["values"]:
if value["commandClass"] == CommandClass.SWITCH_MULTILEVEL:
@@ -2198,7 +2198,7 @@ async def test_window_covering_cover_moving_state_no_position(
window_covering_outbound_bottom_no_position: Node,
integration: MockConfigEntry,
) -> None:
- """Test that moving state is never set for Window Covering without position support."""
+ """Test moving state not set for Window Covering without position."""
entity_id = "cover.node_2_outbound_bottom"
# No SET_POSITION feature — open_cover must NOT set OPENING.
diff --git a/tests/components/zwave_js/test_device_trigger.py b/tests/components/zwave_js/test_device_trigger.py
index 9a5166393fa..92dc404087b 100644
--- a/tests/components/zwave_js/test_device_trigger.py
+++ b/tests/components/zwave_js/test_device_trigger.py
@@ -54,7 +54,7 @@ async def test_get_notification_notification_triggers(
lock_schlage_be469,
integration,
) -> None:
- """Test we get the expected triggers from a zwave_js device with the Notification CC."""
+ """Test expected triggers from a device with Notification CC."""
device = device_registry.async_get_device(
identifiers={get_device_id(client.driver, lock_schlage_be469)}
)
@@ -164,12 +164,12 @@ async def test_if_notification_notification_fires(
await hass.async_block_till_done()
assert len(service_calls) == 2
assert (
- service_calls[0].data["some"]
- == f"event.notification.notification - device - zwave_js_notification - {CommandClass.NOTIFICATION}"
+ service_calls[0].data["some"] == "event.notification.notification - device"
+ f" - zwave_js_notification - {CommandClass.NOTIFICATION}"
)
assert (
- service_calls[1].data["some"]
- == f"event.notification.notification2 - device - zwave_js_notification - {CommandClass.NOTIFICATION}"
+ service_calls[1].data["some"] == "event.notification.notification2 - device"
+ f" - zwave_js_notification - {CommandClass.NOTIFICATION}"
)
@@ -180,7 +180,7 @@ async def test_get_trigger_capabilities_notification_notification(
lock_schlage_be469,
integration,
) -> None:
- """Test we get the expected capabilities from a notification.notification trigger."""
+ """Test capabilities from a notification.notification trigger."""
device = device_registry.async_get_device(
identifiers={get_device_id(client.driver, lock_schlage_be469)}
)
@@ -304,12 +304,12 @@ async def test_if_entry_control_notification_fires(
await hass.async_block_till_done()
assert len(service_calls) == 2
assert (
- service_calls[0].data["some"]
- == f"event.notification.notification - device - zwave_js_notification - {CommandClass.ENTRY_CONTROL}"
+ service_calls[0].data["some"] == "event.notification.notification - device"
+ f" - zwave_js_notification - {CommandClass.ENTRY_CONTROL}"
)
assert (
- service_calls[1].data["some"]
- == f"event.notification.notification2 - device - zwave_js_notification - {CommandClass.ENTRY_CONTROL}"
+ service_calls[1].data["some"] == "event.notification.notification2 - device"
+ f" - zwave_js_notification - {CommandClass.ENTRY_CONTROL}"
)
@@ -320,7 +320,7 @@ async def test_get_trigger_capabilities_entry_control_notification(
lock_schlage_be469,
integration,
) -> None:
- """Test we get the expected capabilities from a notification.entry_control trigger."""
+ """Test capabilities from a notification.entry_control trigger."""
device = device_registry.async_get_device(
identifiers={get_device_id(client.driver, lock_schlage_be469)}
)
@@ -365,7 +365,7 @@ async def test_get_node_status_triggers(
lock_schlage_be469,
integration,
) -> None:
- """Test we get the expected triggers from a device with node status sensor enabled."""
+ """Test expected triggers from device with node status enabled."""
device = device_registry.async_get_device(
identifiers={get_device_id(client.driver, lock_schlage_be469)}
)
@@ -760,12 +760,12 @@ async def test_if_basic_value_notification_fires(
await hass.async_block_till_done()
assert len(service_calls) == 2
assert (
- service_calls[0].data["some"]
- == f"event.value_notification.basic - device - zwave_js_value_notification - {CommandClass.BASIC}"
+ service_calls[0].data["some"] == "event.value_notification.basic - device"
+ f" - zwave_js_value_notification - {CommandClass.BASIC}"
)
assert (
- service_calls[1].data["some"]
- == f"event.value_notification.basic2 - device - zwave_js_value_notification - {CommandClass.BASIC}"
+ service_calls[1].data["some"] == "event.value_notification.basic2 - device"
+ f" - zwave_js_value_notification - {CommandClass.BASIC}"
)
@@ -818,7 +818,7 @@ async def test_get_central_scene_value_notification_triggers(
wallmote_central_scene,
integration,
) -> None:
- """Test we get the expected triggers from a zwave_js device with the Central Scene CC."""
+ """Test expected triggers from a device with Central Scene CC."""
device = device_registry.async_get_device(
identifiers={get_device_id(client.driver, wallmote_central_scene)}
)
@@ -953,11 +953,15 @@ async def test_if_central_scene_value_notification_fires(
assert len(service_calls) == 2
assert (
service_calls[0].data["some"]
- == f"event.value_notification.central_scene - device - zwave_js_value_notification - {CommandClass.CENTRAL_SCENE}"
+ == "event.value_notification.central_scene - device"
+ " - zwave_js_value_notification"
+ f" - {CommandClass.CENTRAL_SCENE}"
)
assert (
service_calls[1].data["some"]
- == f"event.value_notification.central_scene2 - device - zwave_js_value_notification - {CommandClass.CENTRAL_SCENE}"
+ == "event.value_notification.central_scene2 - device"
+ " - zwave_js_value_notification"
+ f" - {CommandClass.CENTRAL_SCENE}"
)
@@ -968,7 +972,7 @@ async def test_get_trigger_capabilities_central_scene_value_notification(
wallmote_central_scene,
integration,
) -> None:
- """Test we get the expected capabilities from a value_notification.central_scene trigger."""
+ """Test capabilities from value_notification.central_scene."""
device = device_registry.async_get_device(
identifiers={get_device_id(client.driver, wallmote_central_scene)}
)
@@ -1013,7 +1017,7 @@ async def test_get_scene_activation_value_notification_triggers(
hank_binary_switch,
integration,
) -> None:
- """Test we get the expected triggers from a zwave_js device with the SceneActivation CC."""
+ """Test expected triggers from device with SceneActivation CC."""
device = device_registry.async_get_device(
identifiers={get_device_id(client.driver, hank_binary_switch)}
)
@@ -1142,11 +1146,15 @@ async def test_if_scene_activation_value_notification_fires(
assert len(service_calls) == 2
assert (
service_calls[0].data["some"]
- == f"event.value_notification.scene_activation - device - zwave_js_value_notification - {CommandClass.SCENE_ACTIVATION}"
+ == "event.value_notification.scene_activation - device"
+ " - zwave_js_value_notification"
+ f" - {CommandClass.SCENE_ACTIVATION}"
)
assert (
service_calls[1].data["some"]
- == f"event.value_notification.scene_activation2 - device - zwave_js_value_notification - {CommandClass.SCENE_ACTIVATION}"
+ == "event.value_notification.scene_activation2 - device"
+ " - zwave_js_value_notification"
+ f" - {CommandClass.SCENE_ACTIVATION}"
)
@@ -1157,7 +1165,7 @@ async def test_get_trigger_capabilities_scene_activation_value_notification(
hank_binary_switch,
integration,
) -> None:
- """Test we get the expected capabilities from a value_notification.scene_activation trigger."""
+ """Test capabilities from value_notification.scene_activation."""
device = device_registry.async_get_device(
identifiers={get_device_id(client.driver, hank_binary_switch)}
)
@@ -1395,7 +1403,7 @@ async def test_get_trigger_capabilities_value_updated_value(
lock_schlage_be469,
integration,
) -> None:
- """Test we get the expected capabilities from a zwave_js.value_updated.value trigger."""
+ """Test capabilities from zwave_js.value_updated.value trigger."""
device = device_registry.async_get_device(
identifiers={get_device_id(client.driver, lock_schlage_be469)}
)
@@ -1449,7 +1457,7 @@ async def test_get_value_updated_config_parameter_triggers(
lock_schlage_be469,
integration,
) -> None:
- """Test we get the zwave_js.value_updated.config_parameter trigger from a zwave_js device."""
+ """Test value_updated.config_parameter trigger from a device."""
device = device_registry.async_get_device(
identifiers={get_device_id(client.driver, lock_schlage_be469)}
)
@@ -1554,7 +1562,7 @@ async def test_get_trigger_capabilities_value_updated_config_parameter_range(
lock_schlage_be469,
integration,
) -> None:
- """Test we get the expected capabilities from a range zwave_js.value_updated.config_parameter trigger."""
+ """Test capabilities from a range config_parameter trigger."""
device = device_registry.async_get_device(
identifiers={get_device_id(client.driver, lock_schlage_be469)}
)
@@ -1604,7 +1612,7 @@ async def test_get_trigger_capabilities_value_updated_config_parameter_enumerate
lock_schlage_be469,
integration,
) -> None:
- """Test we get the expected capabilities from an enumerated zwave_js.value_updated.config_parameter trigger."""
+ """Test capabilities from an enumerated config_parameter trigger."""
device = device_registry.async_get_device(
identifiers={get_device_id(client.driver, lock_schlage_be469)}
)
@@ -1753,7 +1761,7 @@ async def test_failure_scenarios(
def test_trigger_schema_coerces_string_values() -> None:
- """Test that trigger schemas accept both int and string values for numeric fields."""
+ """Test trigger schemas accept int and string for numeric fields."""
for command_class_value in (
CommandClass.CENTRAL_SCENE.value,
str(CommandClass.CENTRAL_SCENE.value),
diff --git a/tests/components/zwave_js/test_discovery.py b/tests/components/zwave_js/test_discovery.py
index e08b1476018..dd62350608d 100644
--- a/tests/components/zwave_js/test_discovery.py
+++ b/tests/components/zwave_js/test_discovery.py
@@ -450,7 +450,7 @@ async def test_indicator_test(
async def test_light_device_class_is_null(
hass: HomeAssistant, client, light_device_class_is_null, integration
) -> None:
- """Test that a Multilevel Switch CC value with a null device class is discovered as a light.
+ """Test Multilevel Switch CC with null device class is a light.
Tied to #117121.
"""
diff --git a/tests/components/zwave_js/test_helpers.py b/tests/components/zwave_js/test_helpers.py
index 544b5126567..9f75639c99f 100644
--- a/tests/components/zwave_js/test_helpers.py
+++ b/tests/components/zwave_js/test_helpers.py
@@ -99,7 +99,10 @@ async def test_async_get_provisioning_entry_from_device_id(
)
with pytest.raises(
ValueError,
- match=f"Device {non_zwave_device.id} is not from an existing zwave_js config entry",
+ match=(
+ f"Device {non_zwave_device.id} is not from an"
+ " existing zwave_js config entry"
+ ),
):
await async_get_provisioning_entry_from_device_id(hass, non_zwave_device.id)
diff --git a/tests/components/zwave_js/test_humidifier.py b/tests/components/zwave_js/test_humidifier.py
index 78ea7899287..b8e772ac813 100644
--- a/tests/components/zwave_js/test_humidifier.py
+++ b/tests/components/zwave_js/test_humidifier.py
@@ -485,7 +485,8 @@ async def test_humidifier_missing_mode(
client.async_send_command.reset_mock()
- # Test turning off when device is previously auto for a device which does not have de-humidify mode
+ # Test turning off when device is previously auto for a device
+ # which does not have de-humidify mode
event = Event(
type="value updated",
data={
diff --git a/tests/components/zwave_js/test_init.py b/tests/components/zwave_js/test_init.py
index c8966a412a4..6ed4c940b6c 100644
--- a/tests/components/zwave_js/test_init.py
+++ b/tests/components/zwave_js/test_init.py
@@ -1969,7 +1969,7 @@ async def test_remove_entity_on_value_removed(
client: MagicMock,
integration: MockConfigEntry,
) -> None:
- """Test that when entity primary values are removed the entity becomes unavailable."""
+ """Test entity becomes unavailable when primary values removed."""
idle_cover_status_button_entity = (
"button.4_in_1_sensor_idle_home_security_cover_status"
)
@@ -2359,8 +2359,8 @@ async def test_server_logging(
_reset_mocks()
- # Validate that the server logging doesn't get enabled because HA thinks it already
- # is enabled
+ # Validate that the server logging doesn't get enabled
+ # because HA thinks it already is enabled
await hass.config_entries.async_setup(entry.entry_id)
await hass.async_block_till_done()
assert len(client.async_send_command.call_args_list) == 2
@@ -2376,8 +2376,8 @@ async def test_server_logging(
client.server_logging_enabled = False
await hass.config_entries.async_unload(entry.entry_id)
- # Validate that the server logging was not disabled because HA thinks it is already
- # is disabled
+ # Validate that the server logging was not disabled
+ # because HA thinks it is already disabled
assert len(client.async_send_command.call_args_list) == 0
assert not client.enable_server_logging.called
assert not client.disable_server_logging.called
diff --git a/tests/components/zwave_js/test_light.py b/tests/components/zwave_js/test_light.py
index f58f8427cf2..37e5552bf93 100644
--- a/tests/components/zwave_js/test_light.py
+++ b/tests/components/zwave_js/test_light.py
@@ -1168,8 +1168,9 @@ async def test_light_color_only(
client.async_send_command.reset_mock()
- # Assert that turning on light after off call with unknown off color/brightness state
- # works and that light turns on to white with specified brightness
+ # Assert that turning on light after off call with unknown off
+ # color/brightness state works and turns on to white with
+ # specified brightness
await hass.services.async_call(
LIGHT_DOMAIN,
SERVICE_TURN_ON,
diff --git a/tests/components/zwave_js/test_migrate.py b/tests/components/zwave_js/test_migrate.py
index 4e15bd4a295..8872895a69d 100644
--- a/tests/components/zwave_js/test_migrate.py
+++ b/tests/components/zwave_js/test_migrate.py
@@ -173,7 +173,7 @@ async def test_unique_id_migration_notification_binary_sensor(
client,
integration,
) -> None:
- """Test unique ID is migrated from old format to new for a notification binary sensor."""
+ """Test unique ID migration for a notification binary sensor."""
entity_name = NOTIFICATION_MOTION_BINARY_SENSOR.split(".")[1]
# Create entity RegistryEntry using old unique ID format
@@ -322,7 +322,7 @@ async def test_skip_old_entity_migration_for_multiple(
client,
integration,
) -> None:
- """Test that multiple entities of the same value but on a different endpoint get skipped."""
+ """Test same-value entities on different endpoints get skipped."""
node = Node(client, copy.deepcopy(hank_binary_switch_state))
driver = client.driver
assert driver
@@ -387,7 +387,7 @@ async def test_old_entity_migration_notification_binary_sensor(
client,
integration,
) -> None:
- """Test old entity on a different endpoint is migrated to a new one for a notification binary sensor."""
+ """Test old endpoint entity migrated for notification binary sensor."""
node = Node(client, copy.deepcopy(multisensor_6_state))
driver = client.driver
assert driver
diff --git a/tests/components/zwave_js/test_sensor.py b/tests/components/zwave_js/test_sensor.py
index 91acbd80d2b..ad71b3276a5 100644
--- a/tests/components/zwave_js/test_sensor.py
+++ b/tests/components/zwave_js/test_sensor.py
@@ -359,7 +359,7 @@ async def test_config_parameter_sensor(
async def test_controller_status_sensor(
hass: HomeAssistant, entity_registry: er.EntityRegistry, client, integration
) -> None:
- """Test controller status sensor is created and gets updated on controller state changes."""
+ """Test controller status sensor updates on state changes."""
entity_id = "sensor.z_stick_gen5_usb_controller_status"
entity_entry = entity_registry.async_get(entity_id)
@@ -710,8 +710,8 @@ async def test_special_meters(
],
}
)
- # Add an ElectricScale.KILOVOLT_AMPERE_REACTIVE value to the state so we can test that
- # it is handled differently (no device class)
+ # Add an ElectricScale.KILOVOLT_AMPERE_REACTIVE value to test
+ # that it is handled differently (no device class)
node_data["values"].append(
{
"endpoint": 11,