mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-08-09 20:24:02 +00:00
Add tutorial doctest module and enable top level await (#919)
Add a tutorial module with examples that can be tested with `doctest`. In order to simplify the examples they can be run with doctest allowing top level await statements by adding a fixture to patch the builtins that xdoctest uses to test code. --------- Co-authored-by: Teemu R. <tpr@iki.fi>
This commit is contained in:
@@ -180,7 +180,7 @@ class IotBulb(IotDevice):
|
||||
>>> bulb.presets
|
||||
[LightPreset(index=0, brightness=50, hue=0, saturation=0, color_temp=2700, custom=None, id=None, mode=None), LightPreset(index=1, brightness=100, hue=0, saturation=75, color_temp=0, custom=None, id=None, mode=None), LightPreset(index=2, brightness=100, hue=120, saturation=75, color_temp=0, custom=None, id=None, mode=None), LightPreset(index=3, brightness=100, hue=240, saturation=75, color_temp=0, custom=None, id=None, mode=None)]
|
||||
|
||||
To modify an existing preset, pass :class:`~kasa.smartbulb.LightPreset`
|
||||
To modify an existing preset, pass :class:`~kasa.interfaces.light.LightPreset`
|
||||
instance to :func:`save_preset` method:
|
||||
|
||||
>>> preset = bulb.presets[0]
|
||||
|
@@ -41,7 +41,7 @@ class IotPlug(IotDevice):
|
||||
>>> plug.led
|
||||
True
|
||||
|
||||
For more examples, see the :class:`SmartDevice` class.
|
||||
For more examples, see the :class:`Device` class.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
|
@@ -83,7 +83,7 @@ class IotStrip(IotDevice):
|
||||
>>> strip.is_on
|
||||
True
|
||||
|
||||
For more examples, see the :class:`SmartDevice` class.
|
||||
For more examples, see the :class:`Device` class.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
|
Reference in New Issue
Block a user