mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-11-25 02:38:30 +00:00
Simplify device __repr__ (#805)
Previously:
```
>>> dev
<DeviceType.Hub model H100 at 192.168.xx.xx (Smart Hub), is_on: False - dev specific: {'overheated': False, 'signal_level': 2, 'SSID': 'xx'}>
>>> dev.children[0]
<ChildDevice Temperature Humidity Sensor of <DeviceType.Hub model H100 at 192.168.xx.xx (Smart Hub), is_on: False - dev specific: {'overheated': False, 'signal_level': 2, 'SSID': 'xx'}>>
```
Now:
```
>>> dev
Device: <DeviceType.Hub at 192.168.xx.xx - Smart Hub (H100)>
>>> dev.children[0]
<DeviceType.Sensor Temperature Humidity Sensor (T315) of <DeviceType.Hub at 192.168.xx.xx - Smart Hub (H100)>>
```
This commit is contained in:
@@ -198,7 +198,7 @@ async def test_mac(dev):
|
||||
async def test_representation(dev):
|
||||
import re
|
||||
|
||||
pattern = re.compile("<.* model .* at .* (.*), is_on: .* - dev specific: .*>")
|
||||
pattern = re.compile("<DeviceType\..+ at .+? - .*? \(.+?\)>")
|
||||
assert pattern.match(str(dev))
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user