Files
localthings/tests/test_climate_windfree.py
T
Marc Billow 5547c401ed Address independent review findings on the RAC finish-up branch
- Pin the FAN_ONLY reverse-write fallback to 'Wind' (the original single
  spelling) instead of letting it silently flip to 'Fan' just because
  'Fan' was added second to the dict -- _device_code_for_hvac() resolves
  the code from a unit's own supportedModes first, so this dict is only
  a fallback for a unit reporting none at all, and that fallback
  shouldn't change behavior as an unintended side effect of insertion
  order.
- Add direct tests for _preset_to_ha() (pure function, previously
  untested) and the FAN_ONLY fallback pin.
- Cross-reference the AC family's inverted Light_On/Light_Off polarity
  against air_purifier.py's plain-polarity use of the same token name on
  the same resource name, so a future refactor doesn't assume they're
  the same thing.
- Fix a one-column continuation-line misalignment and a stale PR-number
  reference in a comment.
2026-07-27 05:11:58 +00:00

25 lines
1.0 KiB
Python

"""Tests for the horizontal-swing mapping added to climate.py for issue #75
-- pure dict lookups, testable without a coordinator/entity fixture (see
test_climate_temperature_fallback.py).
The preset side of issue #75 (WindFree/motion convenient modes not
surfacing) is intentionally not addressed here: climate.py's
_preset_to_ha() (issue #91) reads any device preset code straight off the
unit's own supportedModes, replacing the old static _DEVICE_TO_PRESET
table with a generic resolver that covers WindFree/motion generically
instead of a per-model dict -- duplicating that here would just conflict
with it.
"""
from custom_components.localthings.climate import _DEVICE_TO_SWING, _SWING_TO_DEVICE
def test_horizontal_swing_maps_both_directions():
assert _DEVICE_TO_SWING['Left_And_Right'] == 'horizontal'
assert _SWING_TO_DEVICE['horizontal'] == 'Left_And_Right'
def test_existing_swing_modes_unchanged():
assert _DEVICE_TO_SWING['Fix'] == 'off'
assert _DEVICE_TO_SWING['All'] == 'both'
assert _DEVICE_TO_SWING['Up_And_Low'] == 'vertical'