From: Bartosz Golaszewski Date: Wed, 6 Jun 2018 10:49:00 +0000 (+0200) Subject: bindings: python: add a test case for line_event's __repr__ X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=e421f0d7767b9e184861d493e5f7358ea7b9ead3;p=qemu-gpiodev%2Flibgpiod.git bindings: python: add a test case for line_event's __repr__ Check if an event's representation string is generated correctly. Signed-off-by: Bartosz Golaszewski --- diff --git a/bindings/python/examples/gpiod_tests.py b/bindings/python/examples/gpiod_tests.py index 91ea961..36c13b6 100755 --- a/bindings/python/examples/gpiod_tests.py +++ b/bindings/python/examples/gpiod_tests.py @@ -357,6 +357,21 @@ def line_event_poll_fd(): add_test('Monitor multiple lines using their file descriptors', line_event_poll_fd) +def line_event_repr(): + with gpiod.Chip('gpiochip0') as chip: + line = chip.get_line(1) + + print('requesting line for events') + line.request(consumer=sys.argv[0], type=gpiod.LINE_REQ_EV_BOTH_EDGES) + + print('generating a line event') + fire_line_event('gpiochip0', 1, True) + assert line.event_wait(sec=1), 'Expected a line event to occur' + + print('event received: {}'.format(line.event_read())) + +add_test('Line event string repr', line_event_repr) + print('API version is {}'.format(gpiod.version_string())) for name, func in test_cases: