mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-08-07 11:14:02 +00:00
Fix repr for device created with no sysinfo or discovery info" (#1266)
Co-authored-by: Teemu R. <tpr@iki.fi>
This commit is contained in:
@@ -9,7 +9,7 @@ from kasa import Device
|
||||
from kasa.device_type import DeviceType
|
||||
from kasa.protocols.smartprotocol import _ChildProtocolWrapper
|
||||
from kasa.smart.smartchilddevice import SmartChildDevice
|
||||
from kasa.smart.smartdevice import NON_HUB_PARENT_ONLY_MODULES
|
||||
from kasa.smart.smartdevice import NON_HUB_PARENT_ONLY_MODULES, SmartDevice
|
||||
|
||||
from .conftest import (
|
||||
parametrize,
|
||||
@@ -139,3 +139,19 @@ async def test_child_time(dev: Device, freezer: FrozenDateTimeFactory):
|
||||
assert dev.parent is None
|
||||
for child in dev.children:
|
||||
assert child.time != fallback_time
|
||||
|
||||
|
||||
async def test_child_device_type_unknown(caplog):
|
||||
"""Test for device type when category is unknown."""
|
||||
|
||||
class DummyDevice(SmartChildDevice):
|
||||
def __init__(self):
|
||||
super().__init__(
|
||||
SmartDevice("127.0.0.1"),
|
||||
{"device_id": "1", "category": "foobar"},
|
||||
{"device", 1},
|
||||
)
|
||||
|
||||
assert DummyDevice().device_type is DeviceType.Unknown
|
||||
msg = "Unknown child device type foobar for model None, please open issue"
|
||||
assert msg in caplog.text
|
||||
|
Reference in New Issue
Block a user