mirror of
https://github.com/KevinMidboe/python-gpiozero.git
synced 2025-10-29 17:50:37 +00:00
Add more unit tests, fix a few small bugs
This commit is contained in:
@@ -18,6 +18,7 @@ from .exc import (
|
||||
GPIOPinMissing,
|
||||
EnergenieSocketMissing,
|
||||
EnergenieBadSocket,
|
||||
OutputDeviceBadValue,
|
||||
)
|
||||
from .input_devices import Button
|
||||
from .output_devices import OutputDevice, LED, PWMLED, Buzzer, Motor
|
||||
@@ -402,6 +403,8 @@ class LEDBarGraph(LEDCollection):
|
||||
|
||||
@value.setter
|
||||
def value(self, value):
|
||||
if not -1 <= value <= 1:
|
||||
raise OutputDeviceBadValue('LEDBarGraph value must be between -1 and 1')
|
||||
count = len(self)
|
||||
leds = self
|
||||
if value < 0:
|
||||
|
||||
@@ -165,7 +165,7 @@ class SmoothedInputDevice(EventsMixin, InputDevice):
|
||||
if self.partial or self._queue.full.wait(0):
|
||||
return super(SmoothedInputDevice, self).__repr__()
|
||||
else:
|
||||
return "<gpiozero.%s object on pin=%d, pull_up=%s>" % (
|
||||
return "<gpiozero.%s object on pin=%r, pull_up=%s>" % (
|
||||
self.__class__.__name__, self.pin, self.pull_up)
|
||||
|
||||
@property
|
||||
|
||||
@@ -581,7 +581,7 @@ class RGBLED(SourceMixin, Device):
|
||||
|
||||
@property
|
||||
def closed(self):
|
||||
return bool(self._leds)
|
||||
return len(self._leds) == 0
|
||||
|
||||
@property
|
||||
def value(self):
|
||||
|
||||
Reference in New Issue
Block a user