Ejemplo n.º 1
0
def test_parse_para_vs_preformatted():
    s = ' foo\n\nbar\n'
    r = core.parse_txt(s)
    core.show(r)
    pre = list(core.walknode(r, lambda x: x.type == core.T.t_complex_preformatted))[0]
    core.show(pre)
    textnodes = list(core.walknode(pre, lambda x: x.type == core.T.t_text))
    txt = ''.join([x.text for x in textnodes])
    assert u'bar' not in txt
Ejemplo n.º 2
0
def test_no_row_modifier():
    s = "{|\n|foo||bar\n|}"
    r = core.parse_txt(s)
    core.show(r)
    cells = list(core.walknode(r, lambda x: x.type == core.T.t_complex_table_cell))
    print "CELLS:", cells
    assert len(cells) == 2, "expected 2 cells"
Ejemplo n.º 3
0
def test_no_row_modifier():
    s = "{|\n|foo||bar\n|}"
    r = core.parse_txt(s)
    core.show(r)
    cells = list(
        core.walknode(r, lambda x: x.type == core.T.t_complex_table_cell))
    print "CELLS:", cells
    assert len(cells) == 2, "expected 2 cells"
Ejemplo n.º 4
0
def test_duplicate_nesting():
    s = u"""<b>
[[foo|bar]] between
</b>"""
    r = core.parse_txt(s)
    bolds = list(core.walknode(r, lambda x: x.tagname == "b"))
    core.show(bolds)

    for x in bolds:
        for y in x.children or []:
            assert y.tagname != "b"
Ejemplo n.º 5
0
def test_duplicate_nesting():
    s = u"""<b>
[[foo|bar]] between
</b>"""
    r = core.parse_txt(s)
    bolds = list(core.walknode(r, lambda x: x.tagname == "b"))
    core.show(bolds)

    for x in bolds:
        for y in x.children or []:
            assert y.tagname != "b"
Ejemplo n.º 6
0
def test_ref_no_newline():
    s = u"""<ref>* no item</ref>"""
    r = core.parse_txt(s)
    core.show(r)
    linodes = list(core.walknode(r, lambda x: x.tagname == "li"))
    assert not linodes
Ejemplo n.º 7
0
def test_ref_no_newline():
    s = u"""<ref>* no item</ref>"""
    r = core.parse_txt(s)
    core.show(r)
    linodes = list(core.walknode(r, lambda x: x.tagname == "li"))
    assert not linodes