Beispiel #1
0
 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.")
Beispiel #2
0
 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})
Beispiel #4
0
 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})
Beispiel #5
0
 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)        
Beispiel #6
0
 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)
Beispiel #7
0
 def testParseTree1(self):
     text = "tree<ul><li>a</li></ul>"
     parsed = ListTree.parse(text).toString()
     print text
     print parsed
     assert text == parsed
Beispiel #8
0
 def testParseTop(self):
     assert self.topTree, ListTree.parse("top")
Beispiel #9
0
 def assertParsed(self, s):
     print s
     result = ListTree.parse(s).toString()
     print result
     assert s == result
Beispiel #10
0
 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()
Beispiel #11
0
 def testParseSpace(self):
     assert "a" == ListTree.parse("<i>a  </i>").text
Beispiel #12
0
 def testParseTop(self):
     assert self.topTree, ListTree.parse("top")
Beispiel #13
0
 def assertParsed(self, s):
     print s
     result = ListTree.parse(s).toString()
     print result
     assert s == result
Beispiel #14
0
 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()
Beispiel #15
0
 def testParseSpace(self):
     assert "a" == ListTree.parse("<i>a  </i>").text
Beispiel #16
0
 def testParseTree1(self):
     text = "tree<ul><li>a</li></ul>"
     parsed = ListTree.parse(text).toString()
     print text
     print parsed
     assert text == parsed
 def __init__(self, i, aTree):
     self.i = i
     self.tree = ListTree.parse(aTree)