def testParseTreeNoCloseLi(self): try: ListTree.parse("tree<ul><li>a<li>b<ul><li>c</ul></ul>") except Exception: pass else: self.fail("Doesn't handle lists with </li> missing.")
def trees(self): return GridFixture([ [ ListTree.parse("a"), ListTree.parse("<ul><li>a</li></ul>") ], [ ListTree.parse("<ul><li>BB</li></ul>"), ListTree.parse("<ul><li>a</li><li>BB</li></ul>")]], {"name": TreeTypeAdapter})
def trees(self): return GridFixture( [[ListTree.parse("a"), ListTree.parse("<ul><li>a</li></ul>")], [ ListTree.parse("<ul><li>BB</li></ul>"), ListTree.parse("<ul><li>a</li><li>BB</li></ul>") ]], {"name": TreeTypeAdapter})
def tree(self, aString = None): if aString is None: aTree = ListTree("") aTree.addChild(ListTree("a")) aTree.addChild(ListTree("BB")) return aTree else: return ListTree.parse(aString)
def tree(self, aString=None): if aString is None: aTree = ListTree("") aTree.addChild(ListTree("a")) aTree.addChild(ListTree("BB")) return aTree else: return ListTree.parse(aString)
def testParseTree1(self): text = "tree<ul><li>a</li></ul>" parsed = ListTree.parse(text).toString() print text print parsed assert text == parsed
def testParseTop(self): assert self.topTree, ListTree.parse("top")
def assertParsed(self, s): print s result = ListTree.parse(s).toString() print result assert s == result
def testTreeTextWithTags(self): s = "tree<ul><li>a<i>b</i><b>c</b></li></ul>" assert "tree<ul><li>abc</li></ul>" == ListTree.parse(s).textToString()
def testParseSpace(self): assert "a" == ListTree.parse("<i>a </i>").text
def __init__(self, i, aTree): self.i = i self.tree = ListTree.parse(aTree)