mirror of
https://github.com/python-kasa/python-kasa.git
synced 2024-12-22 11:13:34 +00:00
Fix for SmartStrip repr (#169)
* Added unit tests for repr. * Fix repr for SmartStrip. Fixes #165
This commit is contained in:
parent
960ec6a346
commit
461440e8b1
@ -558,9 +558,12 @@ class SmartDevice(object):
|
||||
raise NotImplementedError("Device subclass needs to implement this.")
|
||||
|
||||
def __repr__(self):
|
||||
is_on = self.is_on
|
||||
if callable(is_on):
|
||||
is_on = is_on()
|
||||
return "<%s at %s (%s), is_on: %s - dev specific: %s>" % (
|
||||
self.__class__.__name__,
|
||||
self.host,
|
||||
self.alias,
|
||||
self.is_on,
|
||||
is_on,
|
||||
self.state_information)
|
||||
|
@ -225,6 +225,9 @@ class TestSmartBulb(TestCase):
|
||||
with self.assertRaises(SmartDeviceException):
|
||||
self.bulb.hsv = (0, 0, invalid_brightness)
|
||||
|
||||
def test_repr(self):
|
||||
repr(self.bulb)
|
||||
|
||||
|
||||
class TestSmartBulbLB100(TestSmartBulb):
|
||||
SYSINFO = sysinfo_lb100
|
||||
|
@ -271,6 +271,9 @@ class TestSmartPlugHS100(TestCase):
|
||||
self.sysinfo_schema({'mac': self.plug.mac}) # wrapping for val
|
||||
# TODO check setting?
|
||||
|
||||
def test_repr(self):
|
||||
repr(self.plug)
|
||||
|
||||
|
||||
class TestSmartPlugHS110(TestSmartPlugHS100):
|
||||
SYSINFO = sysinfo_hs110
|
||||
|
@ -436,3 +436,6 @@ class TestSmartStripHS300(TestCase):
|
||||
|
||||
def test_mac(self):
|
||||
self.sysinfo_schema({'mac': self.strip.mac}) # wrapping for vol
|
||||
|
||||
def test_repr(self):
|
||||
repr(self.strip)
|
||||
|
Loading…
Reference in New Issue
Block a user