From 6ca0493406b1f622a2c3e0a9d802957b097767be Mon Sep 17 00:00:00 2001 From: Steven B <51370195+sdb9696@users.noreply.github.com> Date: Sat, 23 Nov 2024 11:37:00 +0000 Subject: [PATCH] Add get_alias for get_feature --- kasa/interfaces/fan.py | 3 +++ tests/smart/modules/test_fan.py | 3 +++ 2 files changed, 6 insertions(+) diff --git a/kasa/interfaces/fan.py b/kasa/interfaces/fan.py index 9462ad88..54fcbe68 100644 --- a/kasa/interfaces/fan.py +++ b/kasa/interfaces/fan.py @@ -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] diff --git a/tests/smart/modules/test_fan.py b/tests/smart/modules/test_fan.py index 9a6878e5..591dd000 100644 --- a/tests/smart/modules/test_fan.py +++ b/tests/smart/modules/test_fan.py @@ -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