mirror of
https://github.com/python-kasa/python-kasa.git
synced 2024-12-22 19:23:34 +00:00
Fix __repr__ function of SmartDevice (#178)
This commit is contained in:
parent
2c79febae4
commit
c9280c70c0
@ -616,7 +616,7 @@ class SmartDevice:
|
||||
is_on = self.is_on
|
||||
if callable(is_on):
|
||||
is_on = is_on()
|
||||
return "<%s at %s (%s), is_on: %s - dev specific: %s>" % (
|
||||
return "<%s model %s at %s (%s), is_on: %s - dev specific: %s>" % (
|
||||
self.__class__.__name__,
|
||||
self.model,
|
||||
self.host,
|
||||
|
@ -654,3 +654,10 @@ def test_cache_invalidates(dev):
|
||||
dev.get_sysinfo()
|
||||
assert query_mock.call_count == 2
|
||||
# assert query_mock.called_once()
|
||||
|
||||
|
||||
def test_representation(dev):
|
||||
import re
|
||||
pattern = re.compile("<.* model .* at .* (.*), is_on: .* - dev specific: .*>")
|
||||
assert pattern.match(str(dev))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user