Add more unit tests, fix a few small bugs

This commit is contained in:
Andrew Scheller
2016-04-30 16:47:29 +01:00
parent 7e6cc39d71
commit fddb95b84b
7 changed files with 164 additions and 4 deletions

View File

@@ -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: