ure_split_empty.py 493 B

1234567891011121314151617181920212223
  1. # test splitting with pattern matches that can be empty
  2. #
  3. # CPython 3.5 issues a FutureWarning for these tests because their
  4. # behaviour will change in a future version. MicroPython just stops
  5. # splitting as soon as an empty match is found.
  6. try:
  7. import ure as re
  8. except ImportError:
  9. print("SKIP")
  10. raise SystemExit
  11. r = re.compile(" *")
  12. s = r.split("a b c foobar")
  13. print(s)
  14. r = re.compile("x*")
  15. s = r.split("foo")
  16. print(s)
  17. r = re.compile("x*")
  18. s = r.split("axbc")
  19. print(s)