]> granicus.if.org Git - python/commitdiff
Change test_htmlparser to reflect the HTMLParser -> html.parser
authorMark Dickinson <dickinsm@gmail.com>
Wed, 21 May 2008 13:51:18 +0000 (13:51 +0000)
committerMark Dickinson <dickinsm@gmail.com>
Wed, 21 May 2008 13:51:18 +0000 (13:51 +0000)
rename in r63439.

Also fix one occurrence of unichr() in html.parser.

Lib/html/parser.py
Lib/test/test_htmlparser.py

index 352a78841c0648afc0d356fc4fe95102a9b264a5..828eece4efb9e6465ae07373ca79ac089e6282f5 100644 (file)
@@ -378,7 +378,7 @@ class HTMLParser(_markupbase.ParserBase):
                 if HTMLParser.entitydefs is None:
                     entitydefs = HTMLParser.entitydefs = {'apos':"'"}
                     for k, v in html.entities.name2codepoint.items():
-                        entitydefs[k] = unichr(v)
+                        entitydefs[k] = chr(v)
                 try:
                     return self.entitydefs[s]
                 except KeyError:
index 8691cbf826a8d62712527419ea589852160191d0..dd74aac09b225529cb7c08c732fe5b0bc202f772 100755 (executable)
@@ -1,17 +1,17 @@
 """Tests for HTMLParser.py."""
 
-import HTMLParser
+import html.parser
 import pprint
 import unittest
 from test import support
 
 
-class EventCollector(HTMLParser.HTMLParser):
+class EventCollector(html.parser.HTMLParser):
 
     def __init__(self):
         self.events = []
         self.append = self.events.append
-        HTMLParser.HTMLParser.__init__(self)
+        html.parser.HTMLParser.__init__(self)
 
     def get_events(self):
         # Normalize the list of events so that buffer artefacts don't
@@ -88,10 +88,10 @@ class TestCaseBase(unittest.TestCase):
 
     def _parse_error(self, source):
         def parse(source=source):
-            parser = HTMLParser.HTMLParser()
+            parser = html.parser.HTMLParser()
             parser.feed(source)
             parser.close()
-        self.assertRaises(HTMLParser.HTMLParseError, parse)
+        self.assertRaises(html.parser.HTMLParseError, parse)
 
 
 class HTMLParserTestCase(TestCaseBase):