Files
core/tests/components/tradfri/test_util.py
T
Franck Nijhof ed79265843 Enable Ruff PT006 (#88165)
* Enable Ruff PT006

* Adjust existing cases

* Fix tests

* Remove unneeded parentheses
2023-02-15 14:09:50 +01:00

32 lines
785 B
Python

"""Tradfri utility function tests."""
import pytest
from homeassistant.components.tradfri.fan import _from_fan_percentage, _from_fan_speed
@pytest.mark.parametrize(
("fan_speed", "expected_result"),
[
(0, 0),
(2, 2),
(25, 49),
(50, 100),
],
)
def test_from_fan_speed(fan_speed, expected_result):
"""Test that we can convert fan speed to percentage value."""
assert _from_fan_speed(fan_speed) == expected_result
@pytest.mark.parametrize(
("percentage", "expected_result"),
[
(1, 2),
(100, 50),
(50, 26),
],
)
def test_from_percentage(percentage, expected_result):
"""Test that we can convert percentage value to fan speed."""
assert _from_fan_percentage(percentage) == expected_result