diff mbox series

[libgpiod,16/22] bindings: python: tests: make EventType private to prevent export

Message ID 20240927-vfazio-mypy-v1-16-91a7c2e20884@xes-inc.com
State New
Headers show
Series bindings: python: conform to mypy and ruff linter recommendations | expand

Commit Message

Vincent Fazio Sept. 27, 2024, 6:53 p.m. UTC
Signed-off-by: Vincent Fazio <vfazio@xes-inc.com>
---
 bindings/python/tests/tests_edge_event.py | 14 +++++++-------
 bindings/python/tests/tests_info_event.py | 10 +++++-----
 2 files changed, 12 insertions(+), 12 deletions(-)

Comments

Bartosz Golaszewski Oct. 8, 2024, 1:29 p.m. UTC | #1
On Fri, Sep 27, 2024 at 8:57 PM Vincent Fazio <vfazio@xes-inc.com> wrote:
>
> Signed-off-by: Vincent Fazio <vfazio@xes-inc.com>
> ---
>  bindings/python/tests/tests_edge_event.py | 14 +++++++-------
>  bindings/python/tests/tests_info_event.py | 10 +++++-----
>  2 files changed, 12 insertions(+), 12 deletions(-)
>

Makes sense! LGTM

Bart
diff mbox series

Patch

diff --git a/bindings/python/tests/tests_edge_event.py b/bindings/python/tests/tests_edge_event.py
index 7e7fada38cf2a983172aaa9c8400fbfe0d3b7a7d..c24d344fdbd6a1b9eda9497afab8a61c5ecb8f09 100644
--- a/bindings/python/tests/tests_edge_event.py
+++ b/bindings/python/tests/tests_edge_event.py
@@ -12,7 +12,7 @@  from gpiod.line import Direction, Edge
 
 from . import gpiosim
 
-EventType = gpiod.EdgeEvent.Type
+_EventType = gpiod.EdgeEvent.Type
 Pull = gpiosim.Chip.Pull
 
 
@@ -87,7 +87,7 @@  class WaitingForEdgeEvents(TestCase):
             events = req.read_edge_events()
             self.assertEqual(len(events), 1)
             event = events[0]
-            self.assertEqual(event.event_type, EventType.RISING_EDGE)
+            self.assertEqual(event.event_type, _EventType.RISING_EDGE)
             self.assertEqual(event.line_offset, 2)
             ts_rising = event.timestamp_ns
 
@@ -95,7 +95,7 @@  class WaitingForEdgeEvents(TestCase):
             events = req.read_edge_events()
             self.assertEqual(len(events), 1)
             event = events[0]
-            self.assertEqual(event.event_type, EventType.FALLING_EDGE)
+            self.assertEqual(event.event_type, _EventType.FALLING_EDGE)
             self.assertEqual(event.line_offset, 2)
             ts_falling = event.timestamp_ns
 
@@ -114,7 +114,7 @@  class WaitingForEdgeEvents(TestCase):
             events = req.read_edge_events()
             self.assertEqual(len(events), 1)
             event = events[0]
-            self.assertEqual(event.event_type, EventType.RISING_EDGE)
+            self.assertEqual(event.event_type, _EventType.RISING_EDGE)
             self.assertEqual(event.line_offset, 6)
 
             self.assertFalse(req.wait_edge_events(timedelta(microseconds=10000)))
@@ -132,7 +132,7 @@  class WaitingForEdgeEvents(TestCase):
             events = req.read_edge_events()
             self.assertEqual(len(events), 1)
             event = events[0]
-            self.assertEqual(event.event_type, EventType.FALLING_EDGE)
+            self.assertEqual(event.event_type, _EventType.FALLING_EDGE)
             self.assertEqual(event.line_offset, 6)
 
             self.assertFalse(req.wait_edge_events(timedelta(microseconds=10000)))
@@ -150,7 +150,7 @@  class WaitingForEdgeEvents(TestCase):
             events = req.read_edge_events()
             self.assertEqual(len(events), 1)
             event = events[0]
-            self.assertEqual(event.event_type, EventType.RISING_EDGE)
+            self.assertEqual(event.event_type, _EventType.RISING_EDGE)
             self.assertEqual(event.line_offset, 2)
             self.assertEqual(event.global_seqno, 1)
             self.assertEqual(event.line_seqno, 1)
@@ -159,7 +159,7 @@  class WaitingForEdgeEvents(TestCase):
             events = req.read_edge_events()
             self.assertEqual(len(events), 1)
             event = events[0]
-            self.assertEqual(event.event_type, EventType.RISING_EDGE)
+            self.assertEqual(event.event_type, _EventType.RISING_EDGE)
             self.assertEqual(event.line_offset, 4)
             self.assertEqual(event.global_seqno, 2)
             self.assertEqual(event.line_seqno, 1)
diff --git a/bindings/python/tests/tests_info_event.py b/bindings/python/tests/tests_info_event.py
index bbdbc0fa6e69c59a32d67d00f5e785105c90e840..1976f4be8b9a63942275875ada00472402524350 100644
--- a/bindings/python/tests/tests_info_event.py
+++ b/bindings/python/tests/tests_info_event.py
@@ -14,7 +14,7 @@  from gpiod.line import Direction
 
 from . import gpiosim
 
-EventType = gpiod.InfoEvent.Type
+_EventType = gpiod.InfoEvent.Type
 
 
 class InfoEventDataclassBehavior(TestCase):
@@ -101,7 +101,7 @@  class WatchingInfoEventWorks(TestCase):
 
         self.assertTrue(self.chip.wait_info_event(datetime.timedelta(seconds=1)))
         event = self.chip.read_info_event()
-        self.assertEqual(event.event_type, EventType.LINE_REQUESTED)
+        self.assertEqual(event.event_type, _EventType.LINE_REQUESTED)
         self.assertEqual(event.line_info.offset, 7)
         self.assertEqual(event.line_info.direction, Direction.INPUT)
         ts_req = event.timestamp_ns
@@ -109,14 +109,14 @@  class WatchingInfoEventWorks(TestCase):
         # Check that we can use a float directly instead of datetime.timedelta.
         self.assertTrue(self.chip.wait_info_event(1.0))
         event = self.chip.read_info_event()
-        self.assertEqual(event.event_type, EventType.LINE_CONFIG_CHANGED)
+        self.assertEqual(event.event_type, _EventType.LINE_CONFIG_CHANGED)
         self.assertEqual(event.line_info.offset, 7)
         self.assertEqual(event.line_info.direction, Direction.OUTPUT)
         ts_rec = event.timestamp_ns
 
         self.assertTrue(self.chip.wait_info_event(datetime.timedelta(seconds=1)))
         event = self.chip.read_info_event()
-        self.assertEqual(event.event_type, EventType.LINE_RELEASED)
+        self.assertEqual(event.event_type, _EventType.LINE_RELEASED)
         self.assertEqual(event.line_info.offset, 7)
         self.assertEqual(event.line_info.direction, Direction.OUTPUT)
         ts_rel = event.timestamp_ns
@@ -146,7 +146,7 @@  class UnwatchingLineInfo(TestCase):
         with self.chip.request_lines(config={0: None}) as request:
             self.assertTrue(self.chip.wait_info_event(datetime.timedelta(seconds=1)))
             event = self.chip.read_info_event()
-            self.assertEqual(event.event_type, EventType.LINE_REQUESTED)
+            self.assertEqual(event.event_type, _EventType.LINE_REQUESTED)
             self.chip.unwatch_line_info(0)
 
         self.assertFalse(