From: Bartosz Golaszewski Date: Fri, 9 Oct 2020 12:22:09 +0000 (+0200) Subject: bindings: python: tests: add a test-case exposing a bug in Line.request() X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=e120d3e996e78ae1f6a5b330d14090c5060fd38a;p=qemu-gpiodev%2Flibgpiod.git bindings: python: tests: add a test-case exposing a bug in Line.request() Calling Line.request() with no keyword arguments leads to an exception being raised by PyDict_Size(). Add a test-case exposing this bug. It will be fixed in the subsequent commit. Reported-by: Jiri Benc Signed-off-by: Bartosz Golaszewski --- diff --git a/bindings/python/tests/gpiod_py_test.py b/bindings/python/tests/gpiod_py_test.py index 572aad8..52a82c5 100755 --- a/bindings/python/tests/gpiod_py_test.py +++ b/bindings/python/tests/gpiod_py_test.py @@ -719,6 +719,15 @@ class LineRequestBehavior(MockupTestCase): self.assertEqual(err_ctx.exception.errno, errno.EPERM) + def test_request_with_no_kwds(self): + with gpiod.Chip(mockup.chip_name(0)) as chip: + line = chip.get_line(2) + line.request(default_consumer) + self.assertTrue(line.is_requested()) + self.assertEqual(line.direction(), gpiod.Line.DIRECTION_INPUT) + line.release() + self.assertFalse(line.is_requested()) + # # Iterator test cases #