mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-10-10 17:38:01 +00:00
add typing hints to make it easier for 3rd party developers to use the library (#90)
* add typing hints to make it easier for 3rd party developers to use the library * remove unused devicetype enum to support python3.3 * add python 3.3 to travis and tox, install typing module in setup.py
This commit is contained in:
@@ -1,11 +1,13 @@
|
||||
from unittest import TestCase, skip, skipIf
|
||||
from voluptuous import Schema, Invalid, All, Range
|
||||
from functools import partial
|
||||
from typing import Any, Dict # noqa: F401
|
||||
|
||||
from .. import SmartBulb, SmartDeviceException
|
||||
from .fakes import (FakeTransportProtocol,
|
||||
sysinfo_lb100, sysinfo_lb110,
|
||||
sysinfo_lb120, sysinfo_lb130)
|
||||
|
||||
BULB_IP = '192.168.250.186'
|
||||
SKIP_STATE_TESTS = False
|
||||
|
||||
@@ -24,7 +26,7 @@ def check_mode(x):
|
||||
|
||||
|
||||
class TestSmartBulb(TestCase):
|
||||
SYSINFO = sysinfo_lb130
|
||||
SYSINFO = sysinfo_lb130 # type: Dict[str, Any]
|
||||
# these schemas should go to the mainlib as
|
||||
# they can be useful when adding support for new features/devices
|
||||
# as well as to check that faked devices are operating properly.
|
||||
@@ -172,7 +174,7 @@ class TestSmartBulb(TestCase):
|
||||
|
||||
def test_current_consumption(self):
|
||||
x = self.bulb.current_consumption()
|
||||
self.assertTrue(isinstance(x, int))
|
||||
self.assertTrue(isinstance(x, float))
|
||||
self.assertTrue(x >= 0.0)
|
||||
|
||||
def test_alias(self):
|
||||
|
@@ -3,6 +3,7 @@ from voluptuous import Schema, Invalid, All, Any, Range
|
||||
from functools import partial
|
||||
import datetime
|
||||
import re
|
||||
from typing import Dict # noqa: F401
|
||||
|
||||
from .. import SmartPlug, SmartDeviceException
|
||||
from .fakes import (FakeTransportProtocol,
|
||||
@@ -35,7 +36,7 @@ def check_mode(x):
|
||||
|
||||
|
||||
class TestSmartPlugHS110(TestCase):
|
||||
SYSINFO = sysinfo_hs110
|
||||
SYSINFO = sysinfo_hs110 # type: Dict
|
||||
# these schemas should go to the mainlib as
|
||||
# they can be useful when adding support for new features/devices
|
||||
# as well as to check that faked devices are operating properly.
|
||||
|
Reference in New Issue
Block a user