mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-11-25 02:38:30 +00:00
Make module names consistent and remove redundant module casting (#909)
Address the inconsistent naming of smart modules by removing all "Module" suffixes and aligning filenames with class names. Removes the casting of modules to the correct module type now that is is redundant. Update the adding of iot modules to use the ModuleName class rather than a free string.
This commit is contained in:
@@ -127,21 +127,21 @@ async def test_get_modules():
|
||||
dummy_device = await get_device_for_fixture_protocol(
|
||||
"KS240(US)_1.0_1.0.5.json", "SMART"
|
||||
)
|
||||
from kasa.smart.modules import CloudModule
|
||||
from kasa.smart.modules import Cloud
|
||||
|
||||
# Modules on device
|
||||
module = dummy_device.modules.get("CloudModule")
|
||||
module = dummy_device.modules.get("Cloud")
|
||||
assert module
|
||||
assert module._device == dummy_device
|
||||
assert isinstance(module, CloudModule)
|
||||
assert isinstance(module, Cloud)
|
||||
|
||||
module = dummy_device.modules.get(Module.Cloud)
|
||||
assert module
|
||||
assert module._device == dummy_device
|
||||
assert isinstance(module, CloudModule)
|
||||
assert isinstance(module, Cloud)
|
||||
|
||||
# Modules on child
|
||||
module = dummy_device.modules.get("FanModule")
|
||||
module = dummy_device.modules.get("Fan")
|
||||
assert module
|
||||
assert module._device != dummy_device
|
||||
assert module._device._parent == dummy_device
|
||||
|
||||
Reference in New Issue
Block a user