circuitpython/tests/extmod/re_split_empty.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

24 lines
484 B
Python
Raw Normal View History

# test splitting with pattern matches that can be empty
#
2023-08-22 11:15:46 -04:00
# CPython 3.5 issues a FutreWarning for these tests because their
# behaviour will change in a futre version. MicroPython just stops
# splitting as soon as an empty match is found.
2017-02-14 17:56:22 -05:00
try:
2023-08-22 11:15:46 -04:00
import re
2017-02-14 17:56:22 -05:00
except ImportError:
print("SKIP")
raise SystemExit
r = re.compile(" *")
s = r.split("a b c foobar")
print(s)
r = re.compile("x*")
s = r.split("foo")
print(s)
r = re.compile("x*")
s = r.split("axbc")
print(s)