Skip to content

Commit 7dd93bb

Browse files
authored
fix(v1): give VacuumModes.OFF a distinct code from GENTLE
1 parent f871c44 commit 7dd93bb

1 file changed

Lines changed: 30 additions & 6 deletions

File tree

‎tests/devices/traits/v1/test_status.py‎

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -432,10 +432,13 @@ def test_cleaning_mode_options() -> None:
432432
CleaningMode.VACUUM,
433433
),
434434
(
435-
VacuumModes.OFF.code,
435+
# 105 is the wire code the device reports for mop-only cleaning,
436+
# shared by VacuumModes.OFF and VacuumModes.GENTLE.
437+
105,
436438
WaterModes.STANDARD.code,
437439
CleanRoutes.STANDARD.code,
438440
CleaningMode.MOP,
441+
439442
),
440443
(
441444
VacuumModes.CUSTOMIZED.code,
@@ -473,7 +476,9 @@ def test_current_cleaning_mode_with_main_brush_lift() -> None:
473476
is_support_main_brush_up_down_supported=True,
474477
is_water_slide_mode_supported=True,
475478
)
476-
status_trait.fan_power = VacuumModes.OFF.code
479+
# 105 is the wire code the device reports for mop-only cleaning,
480+
# shared by VacuumModes.OFF and VacuumModes.GENTLE.
481+
status_trait.fan_power = 105
477482
status_trait.water_box_mode = 235
478483
status_trait.mop_mode = CleanRoutes.STANDARD.code
479484

@@ -590,7 +595,7 @@ def test_get_cleaning_mode_parameters_qrevo_edge_2() -> None:
590595

591596
assert get_cleaning_mode_parameters(CleaningMode.MOP, status_trait._device_features_trait) == [
592597
{
593-
"fan_power": VacuumModes.OFF.code,
598+
"fan_power": 105, # Wire code shared by VacuumModes.OFF and VacuumModes.GENTLE
594599
"water_box_mode": 235,
595600
"mop_mode": CleanRoutes.STANDARD.code,
596601
}
@@ -620,7 +625,7 @@ def test_get_cleaning_mode_parameters_without_clean_route_setting() -> None:
620625
]
621626
assert get_cleaning_mode_parameters(CleaningMode.MOP, status_trait._device_features_trait) == [
622627
{
623-
"fan_power": VacuumModes.OFF.code,
628+
"fan_power": 105, # Wire code shared by VacuumModes.OFF and VacuumModes.GENTLE
624629
"water_box_mode": WaterModes.STANDARD.code,
625630
}
626631
]
@@ -646,7 +651,7 @@ def test_get_cleaning_mode_parameters_water_slide_device() -> None:
646651
]
647652
assert get_cleaning_mode_parameters(CleaningMode.MOP, status_trait._device_features_trait) == [
648653
{
649-
"fan_power": VacuumModes.OFF.code,
654+
"fan_power": 105, # Wire code shared by VacuumModes.OFF and VacuumModes.GENTLE
650655
"water_box_mode": 235,
651656
"mop_mode": CleanRoutes.STANDARD.code,
652657
}
@@ -812,7 +817,26 @@ def test_current_cleaning_mode_gentle_not_mop_without_pure_mop() -> None:
812817
assert status_trait.current_cleaning_mode == CleaningMode.VAC_AND_MOP
813818

814819

815-
def test_water_slide_mode_mapping() -> None:
820+
def test_fan_speed_name_off_on_pure_mop_device() -> None:
821+
"""Code 105 reports as off on pure-mop devices, where OFF is the offered mode."""
822+
status_trait = _create_cleaning_mode_status_trait()
823+
status_trait.fan_power = 105
824+
825+
assert status_trait.fan_speed_mapping[105] == "off"
826+
assert status_trait.fan_speed_name == "off"
827+
828+
829+
def test_fan_speed_name_gentle_without_pure_mop() -> None:
830+
"""Code 105 reports as gentle on devices without pure mop, where GENTLE is offered."""
831+
status_trait = _create_cleaning_mode_status_trait(is_pure_clean_mop_supported=False)
832+
status_trait.fan_power = 105
833+
834+
assert status_trait.fan_speed_mapping[105] == "gentle"
835+
assert status_trait.fan_speed_name == "gentle"
836+
837+
838+
839+
def test_water_slide_mode_mapping() -> None:
816840
"""Test feature-aware water mode mapping for water slide mode devices."""
817841
short_model = mock_data.A114_PRODUCT_DATA["model"].split(".")[-1]
818842
features = DeviceFeatures.from_feature_flags(

0 commit comments

Comments
 (0)