summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/extmod/re_sub.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/tests/extmod/re_sub.py b/tests/extmod/re_sub.py
index 2c7c6c10f..ecaa66d83 100644
--- a/tests/extmod/re_sub.py
+++ b/tests/extmod/re_sub.py
@@ -10,6 +10,8 @@ except AttributeError:
print("SKIP")
raise SystemExit
+import sys
+
def multiply(m):
return str(int(m.group(0)) * 2)
@@ -47,7 +49,11 @@ print(re.sub("(abc)", r"\g<1>\g<1>", "abc"))
print(re.sub("a", "b", "c"))
# with maximum substitution count specified
-print(re.sub("a", "b", "1a2a3a", 2))
+if sys.implementation.name != "micropython":
+ # On CPython 3.13 and later the substitution count must be a keyword argument.
+ print(re.sub("a", "b", "1a2a3a", count=2))
+else:
+ print(re.sub("a", "b", "1a2a3a", 2))
# invalid group
try: