summaryrefslogtreecommitdiff
path: root/tests/extmod/re_sub.py
diff options
context:
space:
mode:
authorDamien George <damien@micropython.org>2024-05-27 12:01:05 +1000
committerDamien George <damien@micropython.org>2024-05-27 13:56:55 +1000
commit1ea06b99d8cc0cbcdb6d136eee607db67d12b37c (patch)
tree95e2c6ed66906cf8afc4d369cf45b2b6d607a8cb /tests/extmod/re_sub.py
parentc0a25a69eb9532396c7ff06dd8ab506403aba4a2 (diff)
tests/extmod: Fix regex strings to be of r"" type.
Otherwise escape characters like \s and \W won't work correctly. Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'tests/extmod/re_sub.py')
-rw-r--r--tests/extmod/re_sub.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/extmod/re_sub.py b/tests/extmod/re_sub.py
index 229c0e63e..2c7c6c10f 100644
--- a/tests/extmod/re_sub.py
+++ b/tests/extmod/re_sub.py
@@ -15,9 +15,9 @@ def multiply(m):
return str(int(m.group(0)) * 2)
-print(re.sub("\d+", multiply, "10 20 30 40 50"))
+print(re.sub(r"\d+", multiply, "10 20 30 40 50"))
-print(re.sub("\d+", lambda m: str(int(m.group(0)) // 2), "10 20 30 40 50"))
+print(re.sub(r"\d+", lambda m: str(int(m.group(0)) // 2), "10 20 30 40 50"))
def A():