Skip to content
Snippets Groups Projects
Unverified Commit 0c5c0939 authored by Robert Resch's avatar Robert Resch Committed by GitHub
Browse files

Remove deprecated fan constants (#131845)

parent 57b099c2
No related branches found
No related tags found
No related merge requests found
...@@ -23,12 +23,6 @@ from homeassistant.const import ( ...@@ -23,12 +23,6 @@ from homeassistant.const import (
from homeassistant.core import HomeAssistant, callback from homeassistant.core import HomeAssistant, callback
from homeassistant.exceptions import ServiceValidationError from homeassistant.exceptions import ServiceValidationError
from homeassistant.helpers import config_validation as cv from homeassistant.helpers import config_validation as cv
from homeassistant.helpers.deprecation import (
DeprecatedConstantEnum,
all_with_deprecated_constants,
check_if_deprecated_constant,
dir_with_deprecated_constants,
)
from homeassistant.helpers.entity import ToggleEntity, ToggleEntityDescription from homeassistant.helpers.entity import ToggleEntity, ToggleEntityDescription
from homeassistant.helpers.entity_component import EntityComponent from homeassistant.helpers.entity_component import EntityComponent
from homeassistant.helpers.entity_platform import EntityPlatform from homeassistant.helpers.entity_platform import EntityPlatform
...@@ -61,21 +55,6 @@ class FanEntityFeature(IntFlag): ...@@ -61,21 +55,6 @@ class FanEntityFeature(IntFlag):
TURN_ON = 32 TURN_ON = 32
# These SUPPORT_* constants are deprecated as of Home Assistant 2022.5.
# Please use the FanEntityFeature enum instead.
_DEPRECATED_SUPPORT_SET_SPEED = DeprecatedConstantEnum(
FanEntityFeature.SET_SPEED, "2025.1"
)
_DEPRECATED_SUPPORT_OSCILLATE = DeprecatedConstantEnum(
FanEntityFeature.OSCILLATE, "2025.1"
)
_DEPRECATED_SUPPORT_DIRECTION = DeprecatedConstantEnum(
FanEntityFeature.DIRECTION, "2025.1"
)
_DEPRECATED_SUPPORT_PRESET_MODE = DeprecatedConstantEnum(
FanEntityFeature.PRESET_MODE, "2025.1"
)
SERVICE_INCREASE_SPEED = "increase_speed" SERVICE_INCREASE_SPEED = "increase_speed"
SERVICE_DECREASE_SPEED = "decrease_speed" SERVICE_DECREASE_SPEED = "decrease_speed"
SERVICE_OSCILLATE = "oscillate" SERVICE_OSCILLATE = "oscillate"
...@@ -543,11 +522,3 @@ class FanEntity(ToggleEntity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_): ...@@ -543,11 +522,3 @@ class FanEntity(ToggleEntity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
Requires FanEntityFeature.SET_SPEED. Requires FanEntityFeature.SET_SPEED.
""" """
return self._attr_preset_modes return self._attr_preset_modes
# These can be removed if no deprecated constant are in this module anymore
__getattr__ = ft.partial(check_if_deprecated_constant, module_globals=globals())
__dir__ = ft.partial(
dir_with_deprecated_constants, module_globals_keys=[*globals().keys()]
)
__all__ = all_with_deprecated_constants(globals())
...@@ -4,7 +4,6 @@ from unittest.mock import patch ...@@ -4,7 +4,6 @@ from unittest.mock import patch
import pytest import pytest
from homeassistant.components import fan
from homeassistant.components.fan import ( from homeassistant.components.fan import (
ATTR_PRESET_MODE, ATTR_PRESET_MODE,
ATTR_PRESET_MODES, ATTR_PRESET_MODES,
...@@ -27,8 +26,6 @@ from tests.common import ( ...@@ -27,8 +26,6 @@ from tests.common import (
MockConfigEntry, MockConfigEntry,
MockModule, MockModule,
MockPlatform, MockPlatform,
help_test_all,
import_and_test_deprecated_constant_enum,
mock_integration, mock_integration,
mock_platform, mock_platform,
setup_test_component_platform, setup_test_component_platform,
...@@ -166,23 +163,6 @@ async def test_preset_mode_validation( ...@@ -166,23 +163,6 @@ async def test_preset_mode_validation(
assert exc.value.translation_key == "not_valid_preset_mode" assert exc.value.translation_key == "not_valid_preset_mode"
def test_all() -> None:
"""Test module.__all__ is correctly set."""
help_test_all(fan)
@pytest.mark.parametrize(("enum"), list(fan.FanEntityFeature))
def test_deprecated_constants(
caplog: pytest.LogCaptureFixture,
enum: fan.FanEntityFeature,
) -> None:
"""Test deprecated constants."""
if not FanEntityFeature.TURN_OFF and not FanEntityFeature.TURN_ON:
import_and_test_deprecated_constant_enum(
caplog, fan, enum, "SUPPORT_", "2025.1"
)
def test_deprecated_supported_features_ints(caplog: pytest.LogCaptureFixture) -> None: def test_deprecated_supported_features_ints(caplog: pytest.LogCaptureFixture) -> None:
"""Test deprecated supported features ints.""" """Test deprecated supported features ints."""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment