Skip to content

Commit f850701

Browse files
d-walshclaude
andcommitted
review: add intentional-5-speeds comment; rename misleading tests
- Add inline comment at the speeds == 3 branch explaining that 3-speed-reporting units under-report their capability and intentionally receive the full 5-speed list. - Rename test_set_fan_speed_accepts_superquiet_on_3speed → test_get_fan_speeds_includes_superquiet_on_3speed and test_set_fan_speed_accepts_superpowerful_on_3speed → test_get_fan_speeds_includes_superpowerful_on_3speed. These tests assert get_fan_speeds() membership, not set_fan_speed() behaviour; rename + docstring fix makes that accurate. Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 7a2caf5 commit f850701

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

pykumo/py_kumo.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,10 @@ def get_fan_speeds(self):
389389
)
390390

391391
if speeds == 3:
392+
# Intentionally return all 5 speeds even though the profile reports
393+
# numberOfFanSpeeds=3. These units under-report their capability:
394+
# real hardware accepts the full superQuiet..superPowerful range,
395+
# as confirmed on units in the field.
392396
valid_speeds = ["superQuiet", "quiet", "low", "powerful", "superPowerful"]
393397
elif speeds == 4:
394398
valid_speeds = ["quiet", "Low", "powerful", "superPowerful"]

tests/test_fan_speeds.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,17 +62,17 @@ def test_5speed_unchanged(self):
6262
speeds, ["superQuiet", "quiet", "low", "powerful", "superPowerful"]
6363
)
6464

65-
def test_set_fan_speed_accepts_superquiet_on_3speed(self):
66-
"""set_fan_speed must accept superQuiet for 3-speed units."""
65+
def test_get_fan_speeds_includes_superquiet_on_3speed(self):
66+
"""get_fan_speeds() must include superQuiet for 3-speed units."""
6767
with patch.object(PyKumo, "__init__", lambda self, *a, **kw: None):
6868
unit = PyKumo.__new__(PyKumo)
6969
unit._profile = {"numberOfFanSpeeds": 3}
7070
unit._status = {}
7171
valid = unit.get_fan_speeds()
7272
self.assertIn("superQuiet", valid)
7373

74-
def test_set_fan_speed_accepts_superpowerful_on_3speed(self):
75-
"""set_fan_speed must accept superPowerful for 3-speed units."""
74+
def test_get_fan_speeds_includes_superpowerful_on_3speed(self):
75+
"""get_fan_speeds() must include superPowerful for 3-speed units."""
7676
with patch.object(PyKumo, "__init__", lambda self, *a, **kw: None):
7777
unit = PyKumo.__new__(PyKumo)
7878
unit._profile = {"numberOfFanSpeeds": 3}

0 commit comments

Comments
 (0)