summaryrefslogtreecommitdiff
path: root/tests/extmod/ure1.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/extmod/ure1.py')
-rw-r--r--tests/extmod/ure1.py61
1 files changed, 39 insertions, 22 deletions
diff --git a/tests/extmod/ure1.py b/tests/extmod/ure1.py
index ae9ff3470..9e1be5fc7 100644
--- a/tests/extmod/ure1.py
+++ b/tests/extmod/ure1.py
@@ -70,11 +70,16 @@ print(m.group(0))
m = re.search("w.r", "hello world")
print(m.group(0))
-m = re.match('a+?', 'ab'); print(m.group(0))
-m = re.match('a*?', 'ab'); print(m.group(0))
-m = re.match('^ab$', 'ab'); print(m.group(0))
-m = re.match('a|b', 'b'); print(m.group(0))
-m = re.match('a|b|c', 'c'); print(m.group(0))
+m = re.match("a+?", "ab")
+print(m.group(0))
+m = re.match("a*?", "ab")
+print(m.group(0))
+m = re.match("^ab$", "ab")
+print(m.group(0))
+m = re.match("a|b", "b")
+print(m.group(0))
+m = re.match("a|b|c", "c")
+print(m.group(0))
# Case where anchors fail to match
r = re.compile("^b|b$")
@@ -87,24 +92,36 @@ except:
print("Caught invalid regex")
# bytes objects
-m = re.match(rb'a+?', b'ab'); print(m.group(0))
+m = re.match(rb"a+?", b"ab")
+print(m.group(0))
print("===")
# escaping
-m = re.match(r'a\.c', 'a.c'); print(m.group(0) if m else '')
-m = re.match(r'a\.b', 'abc'); print(m is None)
-m = re.match(r'a\.b', 'a\\bc'); print(m is None)
-m = re.match(r'[a\-z]', 'abc'); print(m.group(0))
-m = re.match(r'[.\]]*', '.].]a'); print(m.group(0))
-m = re.match(r'[.\]+]*', '.]+.]a'); print(m.group(0))
-m = re.match(r'[a-f0-9x\-yz]*', 'abxcd1-23'); print(m.group(0))
-m = re.match(r'[a\\b]*', 'a\\aa\\bb\\bbab'); print(m.group(0))
-m = re.search(r'[a\-z]', '-'); print(m.group(0))
-m = re.search(r'[a\-z]', 'f'); print(m is None)
-m = re.search(r'[a\]z]', 'a'); print(m.group(0))
-print(re.compile(r'[-a]').split('foo-bar'))
-print(re.compile(r'[a-]').split('foo-bar'))
-print(re.compile(r'[ax\-]').split('foo-bar'))
-print(re.compile(r'[a\-x]').split('foo-bar'))
-print(re.compile(r'[\-ax]').split('foo-bar'))
+m = re.match(r"a\.c", "a.c")
+print(m.group(0) if m else "")
+m = re.match(r"a\.b", "abc")
+print(m is None)
+m = re.match(r"a\.b", "a\\bc")
+print(m is None)
+m = re.match(r"[a\-z]", "abc")
+print(m.group(0))
+m = re.match(r"[.\]]*", ".].]a")
+print(m.group(0))
+m = re.match(r"[.\]+]*", ".]+.]a")
+print(m.group(0))
+m = re.match(r"[a-f0-9x\-yz]*", "abxcd1-23")
+print(m.group(0))
+m = re.match(r"[a\\b]*", "a\\aa\\bb\\bbab")
+print(m.group(0))
+m = re.search(r"[a\-z]", "-")
+print(m.group(0))
+m = re.search(r"[a\-z]", "f")
+print(m is None)
+m = re.search(r"[a\]z]", "a")
+print(m.group(0))
+print(re.compile(r"[-a]").split("foo-bar"))
+print(re.compile(r"[a-]").split("foo-bar"))
+print(re.compile(r"[ax\-]").split("foo-bar"))
+print(re.compile(r"[a\-x]").split("foo-bar"))
+print(re.compile(r"[\-ax]").split("foo-bar"))
print("===")