Skip to content

Commit

Permalink
Remove deprecated supported features warning in CoverEntity (home-ass…
Browse files Browse the repository at this point in the history
…istant#132367)

Cleanup magic numbers for cover supported features
  • Loading branch information
epenet authored Dec 5, 2024
1 parent 1ca2f33 commit b2ac16e
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 23 deletions.
4 changes: 0 additions & 4 deletions homeassistant/components/cover/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,10 +300,6 @@ def state_attributes(self) -> dict[str, Any]:
def supported_features(self) -> CoverEntityFeature:
"""Flag supported features."""
if (features := self._attr_supported_features) is not None:
if type(features) is int: # noqa: E721
new_features = CoverEntityFeature(features)
self._report_deprecated_supported_features_values(new_features)
return new_features
return features

supported_features = (
Expand Down
19 changes: 0 additions & 19 deletions tests/components/cover/test_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

from enum import Enum

import pytest

from homeassistant.components import cover
from homeassistant.components.cover import CoverState
from homeassistant.const import ATTR_ENTITY_ID, CONF_PLATFORM, SERVICE_TOGGLE
Expand Down Expand Up @@ -155,20 +153,3 @@ def _create_tuples(enum: type[Enum], constant_prefix: str) -> list[tuple[Enum, s
def test_all() -> None:
"""Test module.__all__ is correctly set."""
help_test_all(cover)


def test_deprecated_supported_features_ints(caplog: pytest.LogCaptureFixture) -> None:
"""Test deprecated supported features ints."""

class MockCoverEntity(cover.CoverEntity):
_attr_supported_features = 1

entity = MockCoverEntity()
assert entity.supported_features is cover.CoverEntityFeature(1)
assert "MockCoverEntity" in caplog.text
assert "is using deprecated supported features values" in caplog.text
assert "Instead it should use" in caplog.text
assert "CoverEntityFeature.OPEN" in caplog.text
caplog.clear()
assert entity.supported_features is cover.CoverEntityFeature(1)
assert "is using deprecated supported features values" not in caplog.text

0 comments on commit b2ac16e

Please sign in to comment.