Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
def test_partitioning():
expr = re.compile(r'\*(.*)\*')
children = [docutils.nodes.Text('hello *world* goodbye')]
left, matched, right = inline.re_partition(children, expr)
print(left, matched, right)
assert len(left) == len(right) == 1
assert len(matched) == 2
assert len(matched[0]) == len(matched[1]) == 1
assert left[0] == 'hello '
assert right[0] == ' goodbye'
assert matched[0][0] == '*world*'
assert matched[1][0] == 'world'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.