tests/extmod/ure_namedclass: Add tests for named classes in class sets.

Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
Damien George 2023-01-18 09:13:35 +11:00
parent 64193c7de9
commit fc745d85fe
1 changed files with 6 additions and 1 deletions

View File

@ -15,7 +15,7 @@ def print_groups(match):
try:
i = 0
while True:
print(m.group(i))
print(match.group(i))
i += 1
except IndexError:
pass
@ -32,3 +32,8 @@ print_groups(m)
m = re.match(r"(([0-9]*)([a-z]*)\d*)", "1234hello567")
print_groups(m)
# named class within a class set
print_groups(re.match("([^\s]+)\s*([^\s]+)", "1 23"))
print_groups(re.match("([\s\d]+)([\W]+)", "1 2-+="))
print_groups(re.match("([\W]+)([^\W]+)([^\S]+)([^\D]+)", " a_1 23"))