2016-04-26 05:19:04 -04:00
|
|
|
# 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
|
2016-04-26 05:19:04 -04:00
|
|
|
# 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")
|
2017-06-10 13:14:16 -04:00
|
|
|
raise SystemExit
|
2016-04-26 05:19:04 -04:00
|
|
|
|
|
|
|
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)
|