Created
December 31, 2016 15:51
-
-
Save Alphadelta14/5e6c249012d85e28a45c7d6cf2428926 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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