@@ -208,19 +208,35 @@ def runTest(self, innerHTML, input, expected, errors, treeClass):
208208 document = p .parse (StringIO .StringIO (input ))
209209 document = treeClass .get ("adapter" , lambda x : x )(document )
210210 try :
211- output = convertTokens (LintFilter ( treeClass ["walker" ](document ) ))
211+ output = convertTokens (treeClass ["walker" ](document ))
212212 output = attrlist .sub (sortattrs , output )
213213 expected = attrlist .sub (sortattrs , convertExpected (expected ))
214214 self .assertEquals (expected , output , "\n " .join ([
215215 "" , "Input:" , input ,
216216 "" , "Expected:" , expected ,
217217 "" , "Recieved:" , output
218218 ]))
219- except LintError , le :
220- self .fail (input + "\n " + le .message )
221219 except NotImplementedError :
222220 pass # Amnesty for those that confess...
223221
222+ class TokenTestCase (unittest .TestCase ):
223+ def test_all_tokens (self ):
224+ expected = [
225+ {'data' : [], 'type' : 'StartTag' , 'name' : u'html' },
226+ {'data' : [], 'type' : 'StartTag' , 'name' : u'head' },
227+ {'data' : [], 'type' : 'EndTag' , 'name' : u'head' },
228+ {'data' : [], 'type' : 'StartTag' , 'name' : u'body' },
229+ {'data' : [], 'type' : 'EndTag' , 'name' : u'body' },
230+ {'data' : [], 'type' : 'EndTag' , 'name' : u'html' }]
231+ for treeName , treeCls in treeTypes .iteritems ():
232+ p = html5parser .HTMLParser (tree = treeCls ["builder" ])
233+ document = p .parse ("<html></html>" )
234+ document = treeCls .get ("adapter" , lambda x : x )(document )
235+ output = treeCls ["walker" ](document )
236+ for expectedToken , outputToken in zip (expected , output ):
237+ self .assertEquals (expectedToken , outputToken )
238+
239+
224240def buildTestSuite ():
225241 sys .stdout .write ('Testing tree walkers ' + " " .join (treeTypes .keys ()) + "\n " )
226242
0 commit comments