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
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"
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"
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"
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