Remote platform back-compat for custom components without RemoteEntityFeature (#106609)

This commit is contained in:
J. Nick Koston 2023-12-28 13:15:48 -10:00 committed by GitHub
parent a46fe94216
commit 97ee7e2c98
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 34 additions and 1 deletions

View file

@ -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