mirror of
https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git
synced 2026-10-25 12:39:18 +03:00
The line.Value represents the logical line state, so intuitively you would expect it to be able to be cast to bool, with ACTIVE corresponding to True, and INACTIVE to False. Add a test that line.Value can be cast to bool. Signed-off-by: Kent Gibson <warthog618@gmail.com> Link: https://lore.kernel.org/r/20240522004643.96863-2-warthog618@gmail.com Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
12 lines
321 B
Python
12 lines
321 B
Python
# SPDX-License-Identifier: LGPL-2.1-or-later
|
|
# SPDX-FileCopyrightText: 2024 Kent Gibson <warthog618@gmail.com>
|
|
|
|
from gpiod.line import Value
|
|
from unittest import TestCase
|
|
|
|
|
|
class LineValue(TestCase):
|
|
def test_cast_bool(self):
|
|
self.assertTrue(bool(Value.ACTIVE))
|
|
self.assertFalse(bool(Value.INACTIVE))
|