2024-03-06 18:04:09 +00:00
|
|
|
import pytest
|
|
|
|
|
|
|
|
from kasa.smart.modules import HumiditySensor
|
|
|
|
from kasa.tests.device_fixtures import parametrize
|
|
|
|
|
2024-03-15 15:55:48 +00:00
|
|
|
humidity = parametrize(
|
|
|
|
"has humidity", component_filter="humidity", protocol_filter={"SMART.CHILD"}
|
|
|
|
)
|
2024-03-06 18:04:09 +00:00
|
|
|
|
|
|
|
|
|
|
|
@humidity
|
|
|
|
@pytest.mark.parametrize(
|
|
|
|
"feature, type",
|
|
|
|
[
|
|
|
|
("humidity", int),
|
|
|
|
("humidity_warning", bool),
|
|
|
|
],
|
|
|
|
)
|
|
|
|
async def test_humidity_features(dev, feature, type):
|
|
|
|
"""Test that features are registered and work as expected."""
|
|
|
|
humidity: HumiditySensor = dev.modules["HumiditySensor"]
|
|
|
|
|
|
|
|
prop = getattr(humidity, feature)
|
|
|
|
assert isinstance(prop, type)
|
|
|
|
|
2024-05-13 16:34:44 +00:00
|
|
|
feat = dev.features[feature]
|
2024-03-06 18:04:09 +00:00
|
|
|
assert feat.value == prop
|
|
|
|
assert isinstance(feat.value, type)
|