Do not expose child modules on parent devices (#964)

Removes the logic to expose child modules on parent devices,
which could cause complications with downstream consumers unknowingly duplicating things.
This commit is contained in:
Steven B
2024-06-10 05:59:37 +01:00
committed by GitHub
parent b094e334ca
commit fe0bbf1b98
6 changed files with 34 additions and 38 deletions

View File

@@ -2,7 +2,7 @@ import pytest
from kasa.iot import IotDevice
from kasa.smart import SmartDevice
from kasa.tests.conftest import dimmable_iot, parametrize
from kasa.tests.conftest import dimmable_iot, get_parent_and_child_modules, parametrize
brightness = parametrize("brightness smart", component_filter="brightness")
@@ -10,13 +10,13 @@ brightness = parametrize("brightness smart", component_filter="brightness")
@brightness
async def test_brightness_component(dev: SmartDevice):
"""Test brightness feature."""
brightness = dev.modules.get("Brightness")
brightness = next(get_parent_and_child_modules(dev, "Brightness"))
assert brightness
assert isinstance(dev, SmartDevice)
assert "brightness" in dev._components
# Test getting the value
feature = dev.features["brightness"]
feature = brightness._device.features["brightness"]
assert isinstance(feature.value, int)
assert feature.value > 1 and feature.value <= 100