Add get_alias for get_feature

This commit is contained in:
Steven B 2024-11-23 11:37:00 +00:00
parent cc9930ecc6
commit 6ca0493406
No known key found for this signature in database
GPG Key ID: 6D5B46B3679F2A43
2 changed files with 6 additions and 0 deletions

View File

@ -21,3 +21,6 @@ class Fan(Module, ABC):
self, level: int
) -> Annotated[dict, FeatureAttribute()]:
"""Set fan speed level."""
Fan.get_fan_speed_level = Fan.fan_speed_level.fget # type: ignore[attr-defined]

View File

@ -96,6 +96,9 @@ async def test_fan_features(dev: SmartDevice, mocker: MockerFixture):
assert fan
expected_feature = fan._module_features["fan_speed_level"]
fan_speed_level_feature = fan.get_feature(fan.get_fan_speed_level)
assert expected_feature == fan_speed_level_feature
fan_speed_level_feature = fan.get_feature(Fan.set_fan_speed_level)
assert expected_feature == fan_speed_level_feature