mirror of
https://github.com/python-kasa/python-kasa.git
synced 2024-12-26 21:13:34 +00:00
29 lines
728 B
Python
29 lines
728 B
Python
import pytest
|
|
|
|
from kasa.smart.modules import HumiditySensor
|
|
from kasa.tests.device_fixtures import parametrize
|
|
|
|
humidity = parametrize(
|
|
"has humidity", component_filter="humidity", protocol_filter={"SMART.CHILD"}
|
|
)
|
|
|
|
|
|
@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)
|
|
|
|
feat = humidity._module_features[feature]
|
|
assert feat.value == prop
|
|
assert isinstance(feat.value, type)
|