From e421f0d7767b9e184861d493e5f7358ea7b9ead3 Mon Sep 17 00:00:00 2001 From: Bartosz Golaszewski Date: Wed, 6 Jun 2018 12:49:00 +0200 Subject: [PATCH] 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 --- bindings/python/examples/gpiod_tests.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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: -- 2.30.2