bindings: python: tests: fix invalid syntax warnings
authorBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Wed, 22 May 2024 18:07:34 +0000 (20:07 +0200)
committerBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Wed, 22 May 2024 18:07:34 +0000 (20:07 +0200)
Use double '/' for escaping regex special characters for patterns in
python strings to silence the following warnings:

bindings/python/tests/tests_edge_event.py:211: SyntaxWarning: invalid escape sequence '\.'
  "<EdgeEvent type=Type\.RISING_EDGE timestamp_ns=[0-9]+ line_offset=0 global_seqno=1 line_seqno=1>",
bindings/python/tests/tests_info_event.py:188: SyntaxWarning: invalid escape sequence '\.'
  '<InfoEvent type=Type\.LINE_REQUESTED timestamp_ns=[0-9]+ line_info=<LineInfo offset=0 name="None" used=True consumer="\?" direction=Direction\.INPUT active_low=False bias=Bias\.UNKNOWN drive=Drive\.PUSH_PULL edge_detection=Edge\.NONE event_clock=Clock\.MONOTONIC debounced=False debounce_period=0:00:00>>',

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
bindings/python/tests/tests_edge_event.py
bindings/python/tests/tests_info_event.py

index 430b27de733036cbf11e1ec46bcc6a05ecf28433..17b27026356be60b6e928cff04917f487947824c 100644 (file)
@@ -208,5 +208,5 @@ class EdgeEventStringRepresentation(TestCase):
             event = req.read_edge_events()[0]
             self.assertRegex(
                 str(event),
-                "<EdgeEvent type=Type\.RISING_EDGE timestamp_ns=[0-9]+ line_offset=0 global_seqno=1 line_seqno=1>",
+                "<EdgeEvent type=Type\\.RISING_EDGE timestamp_ns=[0-9]+ line_offset=0 global_seqno=1 line_seqno=1>",
             )
index 6bb09d51dd21b7564bc0d65e780b2298fc6b1edf..a226e52a282347f7514a46f854a9dd5a06a50be8 100644 (file)
@@ -185,5 +185,5 @@ class InfoEventStringRepresentation(TestCase):
                 event = chip.read_info_event()
                 self.assertRegex(
                     str(event),
-                    '<InfoEvent type=Type\.LINE_REQUESTED timestamp_ns=[0-9]+ line_info=<LineInfo offset=0 name="None" used=True consumer="\?" direction=Direction\.INPUT active_low=False bias=Bias\.UNKNOWN drive=Drive\.PUSH_PULL edge_detection=Edge\.NONE event_clock=Clock\.MONOTONIC debounced=False debounce_period=0:00:00>>',
+                    '<InfoEvent type=Type\\.LINE_REQUESTED timestamp_ns=[0-9]+ line_info=<LineInfo offset=0 name="None" used=True consumer="\\?" direction=Direction\\.INPUT active_low=False bias=Bias\\.UNKNOWN drive=Drive\\.PUSH_PULL edge_detection=Edge\\.NONE event_clock=Clock\\.MONOTONIC debounced=False debounce_period=0:00:00>>',
                 )