diff --git a/custom_components/adaptive_lighting/switch.py b/custom_components/adaptive_lighting/switch.py index 68da150a..aa5aa899 100644 --- a/custom_components/adaptive_lighting/switch.py +++ b/custom_components/adaptive_lighting/switch.py @@ -28,7 +28,6 @@ from homeassistant.components.light import ( from homeassistant.components.light import DOMAIN as LIGHT_DOMAIN from homeassistant.components.switch import DOMAIN as SWITCH_DOMAIN from homeassistant.components.switch import SwitchEntity -from homeassistant.config_entries import SOURCE_IMPORT from homeassistant.const import ( ATTR_AREA_ID, ATTR_DOMAIN, diff --git a/tests/test_adaptation_utils.py b/tests/test_adaptation_utils.py index f6e87f07..6b55d946 100644 --- a/tests/test_adaptation_utils.py +++ b/tests/test_adaptation_utils.py @@ -3,6 +3,18 @@ from unittest.mock import Mock import pytest +from homeassistant.components.light import ( + ATTR_BRIGHTNESS, + ATTR_BRIGHTNESS_PCT, + ATTR_COLOR_TEMP_KELVIN, + ATTR_EFFECT, + ATTR_FLASH, + ATTR_HS_COLOR, + ATTR_TRANSITION, +) +from homeassistant.const import ATTR_ENTITY_ID, STATE_ON +from homeassistant.core import Context, State + from custom_components.adaptive_lighting.adaptation_utils import ( LightControlAttributes, ServiceData, @@ -17,17 +29,6 @@ from custom_components.adaptive_lighting.adaptation_utils import ( manual_control_event_attribute_to_flags, prepare_adaptation_data, ) -from homeassistant.components.light import ( - ATTR_BRIGHTNESS, - ATTR_BRIGHTNESS_PCT, - ATTR_COLOR_TEMP_KELVIN, - ATTR_EFFECT, - ATTR_FLASH, - ATTR_HS_COLOR, - ATTR_TRANSITION, -) -from homeassistant.const import ATTR_ENTITY_ID, STATE_ON -from homeassistant.core import Context, State @pytest.mark.parametrize( diff --git a/tests/test_color_and_brightness.py b/tests/test_color_and_brightness.py index 80ffd4f3..3ab91ffd 100644 --- a/tests/test_color_and_brightness.py +++ b/tests/test_color_and_brightness.py @@ -11,12 +11,12 @@ import datetime as dt from datetime import UTC, timedelta import pytest + from custom_components.adaptive_lighting.color_and_brightness import ( SunLightSettings, _tanh_day_curve, ) - HALF_WIDTH = 1800 # seconds — matches RAMP_HALF_WIDTH_SECONDS # Fixed reference day: 2026-03-21 in UTC, sunrise 06:00, sunset 18:00. diff --git a/tests/test_config_flow.py b/tests/test_config_flow.py index 858a6721..4a2b3318 100644 --- a/tests/test_config_flow.py +++ b/tests/test_config_flow.py @@ -5,10 +5,17 @@ Covers spec/options-flow/spec.md requirements R1, R2, R3, R5, R6, R7. from __future__ import annotations -from typing import Any -from unittest.mock import patch +from homeassistant.config_entries import SOURCE_IMPORT +from homeassistant.const import CONF_NAME +from homeassistant.data_entry_flow import FlowResultType +from homeassistant.helpers.selector import ( + BooleanSelector, + EntitySelector, + NumberSelector, + NumberSelectorMode, +) +from pytest_homeassistant_custom_component.common import MockConfigEntry -import pytest from custom_components.adaptive_lighting.config_flow import ( SECTION_ADVANCED, SECTION_DAYTIME, @@ -39,18 +46,6 @@ from custom_components.adaptive_lighting.const import ( DEFAULT_SUNSET_ENTITY, DOMAIN, ) -from homeassistant.config_entries import SOURCE_IMPORT -from homeassistant.const import CONF_NAME -from homeassistant.data_entry_flow import FlowResultType -from homeassistant.helpers.selector import ( - BooleanSelector, - EntitySelector, - NumberSelector, - NumberSelectorMode, -) - -from pytest_homeassistant_custom_component.common import MockConfigEntry - EXPECTED_SECTIONS = ( SECTION_TARGETS, diff --git a/tests/test_hass_utils.py b/tests/test_hass_utils.py index a2d80c76..9f044d8a 100644 --- a/tests/test_hass_utils.py +++ b/tests/test_hass_utils.py @@ -2,14 +2,15 @@ from unittest.mock import AsyncMock +from homeassistant.components.light import DOMAIN as LIGHT_DOMAIN +from homeassistant.const import SERVICE_TURN_ON +from homeassistant.core import ServiceCall +from homeassistant.util.read_only_dict import ReadOnlyDict + from custom_components.adaptive_lighting.adaptation_utils import ServiceData from custom_components.adaptive_lighting.hass_utils import ( setup_service_call_interceptor, ) -from homeassistant.components.light import DOMAIN as LIGHT_DOMAIN -from homeassistant.const import SERVICE_TURN_ON -from homeassistant.core import ServiceCall -from homeassistant.util.read_only_dict import ReadOnlyDict async def test_setup_service_call_interceptor(hass): diff --git a/tests/test_init.py b/tests/test_init.py index 49c45701..13e30687 100644 --- a/tests/test_init.py +++ b/tests/test_init.py @@ -7,20 +7,17 @@ from __future__ import annotations import logging -import pytest +from homeassistant.config_entries import ConfigEntryState +from homeassistant.const import CONF_NAME +from homeassistant.helpers import entity_registry as er +from pytest_homeassistant_custom_component.common import MockConfigEntry + from custom_components.adaptive_lighting.const import ( CONFIG_ENTRY_VERSION, DEFAULT_NAME, DOMAIN, UNDO_UPDATE_LISTENER, ) -from homeassistant.config_entries import ConfigEntryState -from homeassistant.const import CONF_NAME -from homeassistant.exceptions import ConfigEntryError -from homeassistant.helpers import entity_registry as er - -from pytest_homeassistant_custom_component.common import MockConfigEntry - # --------------------------------------------------------------------------- # R8 — strict version break