[Python-3000-checkins] r63518 - in python/branches/py3k/Lib: html/parser.py test/test_htmlparser.py

mark.dickinson python-3000-checkins at python.org
Wed May 21 15:51:18 CEST 2008


Author: mark.dickinson
Date: Wed May 21 15:51:18 2008
New Revision: 63518

Log:
Change test_htmlparser to reflect the HTMLParser -> html.parser
rename in r63439.

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


Modified:
   python/branches/py3k/Lib/html/parser.py
   python/branches/py3k/Lib/test/test_htmlparser.py

Modified: python/branches/py3k/Lib/html/parser.py
==============================================================================
--- python/branches/py3k/Lib/html/parser.py	(original)
+++ python/branches/py3k/Lib/html/parser.py	Wed May 21 15:51:18 2008
@@ -378,7 +378,7 @@
                 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:

Modified: python/branches/py3k/Lib/test/test_htmlparser.py
==============================================================================
--- python/branches/py3k/Lib/test/test_htmlparser.py	(original)
+++ python/branches/py3k/Lib/test/test_htmlparser.py	Wed May 21 15:51:18 2008
@@ -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 @@
 
     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):


More information about the Python-3000-checkins mailing list