Files
wecker/tests/test_styles_simple.py
T

24 lines
758 B
Python
Raw Normal View History

from styles.simple import SimpleStyle
def test_simple_keeps_ringing_when_not_pressed():
calls = []
style = SimpleStyle(lambda on: calls.append(on))
assert style.update(0.0, False) is True
assert calls[-1] is True # LED solid on while ringing
def test_simple_stops_on_first_press():
calls = []
style = SimpleStyle(lambda on: calls.append(on))
assert style.update(0.0, True) is False # press -> stop
def test_simple_led_off_on_release_after_press():
# After a press the style stops; verify it never turns the LED off itself
# (the runner's cleanup handles that). It only ever asserts LED on.
calls = []
style = SimpleStyle(lambda on: calls.append(on))
style.update(0.0, False)
assert calls == [True]