Remove deprecated support feature values in media_player (#146986)

This commit is contained in:
G Johansson
2025-06-17 10:33:41 +02:00
committed by GitHub
parent b0c2a47288
commit 308c89af4a
2 changed files with 22 additions and 59 deletions

View File

@@ -152,7 +152,9 @@ def test_support_properties(hass: HomeAssistant, property_suffix: str) -> None:
entity4 = MediaPlayerEntity()
entity4.hass = hass
entity4.platform = MockEntityPlatform(hass)
entity4._attr_supported_features = all_features - feature
entity4._attr_supported_features = media_player.MediaPlayerEntityFeature(
all_features - feature
)
assert getattr(entity1, f"support_{property_suffix}") is False
assert getattr(entity2, f"support_{property_suffix}") is True
@@ -652,27 +654,3 @@ async def test_get_async_get_browse_image_quoting(
url = player.get_browse_image_url("album", media_content_id)
await client.get(url)
mock_browse_image.assert_called_with("album", media_content_id, None)
def test_deprecated_supported_features_ints(
hass: HomeAssistant, caplog: pytest.LogCaptureFixture
) -> None:
"""Test deprecated supported features ints."""
class MockMediaPlayerEntity(MediaPlayerEntity):
@property
def supported_features(self) -> int:
"""Return supported features."""
return 1
entity = MockMediaPlayerEntity()
entity.hass = hass
entity.platform = MockEntityPlatform(hass)
assert entity.supported_features_compat is MediaPlayerEntityFeature(1)
assert "MockMediaPlayerEntity" in caplog.text
assert "is using deprecated supported features values" in caplog.text
assert "Instead it should use" in caplog.text
assert "MediaPlayerEntityFeature.PAUSE" in caplog.text
caplog.clear()
assert entity.supported_features_compat is MediaPlayerEntityFeature(1)
assert "is using deprecated supported features values" not in caplog.text