@@ -360,8 +360,8 @@ def test_entityrefs_in_attributes(self):
360360
361361class HTMLParserTolerantTestCase (TestCaseBase ):
362362
363- def setUp (self ):
364- self . collector = EventCollector (strict = False )
363+ def get_collector (self ):
364+ return EventCollector (strict = False )
365365
366366 def test_tolerant_parsing (self ):
367367 self ._run_check ('<html <html>te>>xt&a<<bc</a></html>\n '
@@ -375,9 +375,10 @@ def test_tolerant_parsing(self):
375375 ('endtag' , 'html' ),
376376 ('data' , '\n <img src="URL><//img></html' ),
377377 ('endtag' , 'html' )],
378- collector = self .collector )
378+ collector = self .get_collector () )
379379
380380 def test_with_unquoted_attributes (self ):
381+ # see #12008
381382 html = ("<html><body bgcolor=d0ca90 text='181008'>"
382383 "<table cellspacing=0 cellpadding=1 width=100% ><tr>"
383384 "<td align=left><font size=-1>"
@@ -399,23 +400,24 @@ def test_with_unquoted_attributes(self):
399400 ('endtag' , 'span' ), ('endtag' , 'a' ), ('endtag' , 'table' )
400401 ]
401402
402- self ._run_check (html , expected , collector = self .collector )
403+ self ._run_check (html , expected , collector = self .get_collector () )
403404
404405 def test_comma_between_attributes (self ):
405406 self ._run_check ('<form action="/xxx.php?a=1&b=2&", '
406407 'method="post">' , [
407408 ('starttag' , 'form' ,
408409 [('action' , '/xxx.php?a=1&b=2&' ),
409410 ('method' , 'post' )])],
410- collector = self .collector )
411+ collector = self .get_collector () )
411412
412413 def test_weird_chars_in_unquoted_attribute_values (self ):
413414 self ._run_check ('<form action=bogus|&#()value>' , [
414415 ('starttag' , 'form' ,
415416 [('action' , 'bogus|&#()value' )])],
416- collector = self .collector )
417+ collector = self .get_collector () )
417418
418- def test_issue13273 (self ):
419+ def test_correct_detection_of_start_tags (self ):
420+ # see #13273
419421 html = ('<div style="" ><b>The <a href="some_url">rain</a> '
420422 '<br /> in <span>Spain</span></b></div>' )
421423 expected = [
@@ -434,9 +436,8 @@ def test_issue13273(self):
434436 ('endtag' , 'b' ),
435437 ('endtag' , 'div' )
436438 ]
437- self ._run_check (html , expected , collector = self .collector )
439+ self ._run_check (html , expected , collector = self .get_collector () )
438440
439- def test_issue13273_2 (self ):
440441 html = '<div style="", foo = "bar" ><b>The <a href="some_url">rain</a>'
441442 expected = [
442443 ('starttag' , 'div' , [('style' , '' ), ('foo' , 'bar' )]),
@@ -446,7 +447,7 @@ def test_issue13273_2(self):
446447 ('data' , 'rain' ),
447448 ('endtag' , 'a' ),
448449 ]
449- self ._run_check (html , expected , collector = self .collector )
450+ self ._run_check (html , expected , collector = self .get_collector () )
450451
451452 def test_unescape_function (self ):
452453 p = html .parser .HTMLParser ()
0 commit comments