def test_cleanSectionCaptions(): raw = r''' ==<center>centered heading</center>== bla ''' tree, reports = cleanMarkup(raw) section_node = tree.getChildNodesByClass(Section)[0] assert _all([p.__class__ != Center for p in section_node.children[0].getAllChildren()])
def test_fixLists3(): raw = r""" * ul1 * ul2 # ol1 # ol2 """ tree, reports = cleanMarkup(raw) assert len(tree.children) == 2 # 2 itemlists as only children of article assert _all([c.__class__ == ItemList for c in tree.children])
def test_cleanSectionCaptions(): raw = r''' ==<center>centered heading</center>== bla ''' tree, reports = cleanMarkup(raw) section_node = tree.getChildNodesByClass(Section)[0] assert _all([ p.__class__ != Center for p in section_node.children[0].getAllChildren() ])
def test_fixLists(): raw = r""" para * list item 1 * list item 2 ** list item 2.1 * list item 3 * list 2 item 1 * list 2 item 2 para * list 3 """ tree, reports = cleanMarkup(raw) lists = tree.getChildNodesByClass(ItemList) for li in lists: print li, li.getParents() assert _all([p.__class__ != Paragraph for p in li.getParents()]) _treesanity(tree)