Add extra TrafficLight tests, and remove the redundant setattr function

- `CompositeDevice`s can't have any of their attributes set anyway
This commit is contained in:
Andrew Scheller
2016-09-19 12:00:38 +01:00
parent 322ec1316a
commit 1b3e6a429b
2 changed files with 6 additions and 7 deletions

View File

@@ -555,6 +555,10 @@ def test_traffic_lights():
assert red_pin.state
assert not amber_pin.state
assert not green_pin.state
board.amber.on()
assert amber_pin.state
board.yellow.off()
assert not amber_pin.state
with TrafficLights(red=red_pin, yellow=amber_pin, green=green_pin) as board:
board.yellow.on()
assert not board.red.value
@@ -564,6 +568,8 @@ def test_traffic_lights():
assert not red_pin.state
assert amber_pin.state
assert not green_pin.state
board.amber.off()
assert not amber_pin.state
def test_traffic_lights_bad_init():
with pytest.raises(ValueError):