diff options
author | Bartosz Golaszewski <bartekgola@gmail.com> | 2018-07-22 20:12:40 +0200 |
---|---|---|
committer | Bartosz Golaszewski <bartekgola@gmail.com> | 2018-07-22 20:14:50 +0200 |
commit | 445793aabf7cf60ff9683b39aacfc4ea4739aed1 (patch) | |
tree | bf1abe06c7bfe73e3311fa0a064964bdd5f5bc13 | |
parent | f8221bc88b8e09929be37bb8f42117b511dc2836 (diff) | |
download | libgpiod-445793aabf7cf60ff9683b39aacfc4ea4739aed1.tar.gz |
bindings: python: examples: new test case
Add a test case for incorrect number of default values in line
requests.
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
-rwxr-xr-x | bindings/python/examples/gpiod_tests.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/bindings/python/examples/gpiod_tests.py b/bindings/python/examples/gpiod_tests.py index 4c2f9a8a..6a30a4c9 100755 --- a/bindings/python/examples/gpiod_tests.py +++ b/bindings/python/examples/gpiod_tests.py @@ -309,6 +309,23 @@ def request_multiple_lines_with_default_values(): add_test('Request multiple lines with default values', request_multiple_lines_with_default_values) +def request_line_incorrect_number_of_def_vals(): + with gpiod.Chip('gpiochip0') as chip: + lines = chip.get_lines(( 1, 2, 3, 4, 5 )) + + print('requesting lines with incorrect number of default values') + try: + lines.request(consumer='gpiod_test.py', + type=gpiod.LINE_REQ_DIR_OUT, + default_vals=( 1, 0, 1, 0 )) + except TypeError: + print('TypeError raised as expected') + return + + assert False, 'TypeError expected' + +add_test('Request with incorrect number of default values', request_line_incorrect_number_of_def_vals) + def line_event_single_line(): chip = gpiod.Chip('gpiochip0') line = chip.get_line(1) |