mirror of
https://github.com/KevinMidboe/python-gpiozero.git
synced 2025-10-29 17:50:37 +00:00
Replace Event.wait(0) with Event.is_set()
The functionality is identical, and IMHO the latter is much more readable
This commit is contained in:
@@ -64,20 +64,20 @@ def test_input_event_activated():
|
||||
pin = MockPin(2)
|
||||
with DigitalInputDevice(pin) as device:
|
||||
device.when_activated = lambda: event.set()
|
||||
assert not event.wait(0)
|
||||
assert not event.is_set()
|
||||
pin.drive_high()
|
||||
assert event.wait(0)
|
||||
assert event.is_set()
|
||||
|
||||
def test_input_event_deactivated():
|
||||
event = Event()
|
||||
pin = MockPin(2)
|
||||
with DigitalInputDevice(pin) as device:
|
||||
device.when_deactivated = lambda: event.set()
|
||||
assert not event.wait(0)
|
||||
assert not event.is_set()
|
||||
pin.drive_high()
|
||||
assert not event.wait(0)
|
||||
assert not event.is_set()
|
||||
pin.drive_low()
|
||||
assert event.wait(0)
|
||||
assert event.is_set()
|
||||
|
||||
def test_input_wait_active():
|
||||
pin = MockPin(2)
|
||||
|
||||
Reference in New Issue
Block a user