From b9a48f7144d915934c00475bd18d2dc8f34576b8 Mon Sep 17 00:00:00 2001 From: Ezio Melotti Date: Tue, 1 Nov 2011 15:00:59 +0200 Subject: Avoid reusing the same collector in the tests. --- Lib/test/test_htmlparser.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/Lib/test/test_htmlparser.py b/Lib/test/test_htmlparser.py index b85beab..c4a8f17 100644 --- a/Lib/test/test_htmlparser.py +++ b/Lib/test/test_htmlparser.py @@ -360,8 +360,8 @@ DOCTYPE html [ class HTMLParserTolerantTestCase(TestCaseBase): - def setUp(self): - self.collector = EventCollector(strict=False) + def get_collector(self): + return EventCollector(strict=False) def test_tolerant_parsing(self): self._run_check('te>>xt&a<\n' @@ -375,9 +375,10 @@ class HTMLParserTolerantTestCase(TestCaseBase): ('endtag', 'html'), ('data', '\n" "" "
" @@ -399,7 +400,7 @@ class HTMLParserTolerantTestCase(TestCaseBase): ('endtag', 'span'), ('endtag', 'a'), ('endtag', 'table') ] - self._run_check(html, expected, collector=self.collector) + self._run_check(html, expected, collector=self.get_collector()) def test_comma_between_attributes(self): self._run_check('
', [ ('starttag', 'form', [('action', 'bogus|&#()value')])], - collector = self.collector) + collector=self.get_collector()) - def test_issue13273(self): + def test_correct_detection_of_start_tags(self): + # see #13273 html = ('
The rain ' '
in Spain
') expected = [ @@ -434,9 +436,8 @@ class HTMLParserTolerantTestCase(TestCaseBase): ('endtag', 'b'), ('endtag', 'div') ] - self._run_check(html, expected, collector=self.collector) + self._run_check(html, expected, collector=self.get_collector()) - def test_issue13273_2(self): html = '
The rain' expected = [ ('starttag', 'div', [('style', ''), ('foo', 'bar')]), @@ -446,7 +447,7 @@ class HTMLParserTolerantTestCase(TestCaseBase): ('data', 'rain'), ('endtag', 'a'), ] - self._run_check(html, expected, collector=self.collector) + self._run_check(html, expected, collector=self.get_collector()) def test_unescape_function(self): p = html.parser.HTMLParser() -- cgit v0.12