def test_parse_link(): result = list(_parse("[link=foo]bar[/link]")) expected = [ (0, None, Tag(name="link", parameters="foo")), (13, "bar", None), (13, None, Tag(name="/link", parameters=None)), ] assert result == expected
def test_parse(): result = list(_parse(r"[foo]hello[/foo][bar]world[/]\[escaped]")) expected = [ (0, None, Tag(name="foo", parameters=None)), (10, "hello", None), (10, None, Tag(name="/foo", parameters=None)), (16, None, Tag(name="bar", parameters=None)), (26, "world", None), (26, None, Tag(name="/", parameters=None)), (29, "[escaped]", None), ] print(repr(result)) assert result == expected
def test_parse(): result = list(_parse("[foo]hello[/foo][bar]world[/][[escaped]]")) expected = [ (0, None, Tag(name="foo", parameters=None)), (10, "hello", None), (10, None, Tag(name="/foo", parameters=None)), (16, None, Tag(name="bar", parameters=None)), (26, "world", None), (26, None, Tag(name="/", parameters=None)), (29, "[", None), (38, "escaped", None), (38, "]", None), ] assert result == expected