Remote platform back-compat for custom components without RemoteEntityFeature (#106609)
This commit is contained in:
parent
a46fe94216
commit
97ee7e2c98
2 changed files with 34 additions and 1 deletions
|
@ -150,3 +150,23 @@ def test_deprecated_constants(
|
|||
) -> None:
|
||||
"""Test deprecated constants."""
|
||||
import_and_test_deprecated_constant_enum(caplog, remote, enum, "SUPPORT_", "2025.1")
|
||||
|
||||
|
||||
def test_deprecated_supported_features_ints(caplog: pytest.LogCaptureFixture) -> None:
|
||||
"""Test deprecated supported features ints."""
|
||||
|
||||
class MockRemote(remote.RemoteEntity):
|
||||
@property
|
||||
def supported_features(self) -> int:
|
||||
"""Return supported features."""
|
||||
return 1
|
||||
|
||||
entity = MockRemote()
|
||||
assert entity.supported_features_compat is remote.RemoteEntityFeature(1)
|
||||
assert "MockRemote" in caplog.text
|
||||
assert "is using deprecated supported features values" in caplog.text
|
||||
assert "Instead it should use" in caplog.text
|
||||
assert "RemoteEntityFeature.LEARN_COMMAND" in caplog.text
|
||||
caplog.clear()
|
||||
assert entity.supported_features_compat is remote.RemoteEntityFeature(1)
|
||||
assert "is using deprecated supported features values" not in caplog.text
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue