summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorWalter Dörwald <walter@livinglogic.de>2003-04-29 20:59:55 (GMT)
committerWalter Dörwald <walter@livinglogic.de>2003-04-29 20:59:55 (GMT)
commit1b0be2d4c64b11b0884b625d6c62259e0c51424b (patch)
treea049b55220717e8728405ef7979c6d143c10f102 /Lib
parent1a4a9d0b0f0bd457ae311c5e1925d6e56e4838cb (diff)
downloadcpython-1b0be2d4c64b11b0884b625d6c62259e0c51424b.zip
cpython-1b0be2d4c64b11b0884b625d6c62259e0c51424b.tar.gz
cpython-1b0be2d4c64b11b0884b625d6c62259e0c51424b.tar.bz2
Use the new htmlentitydefs.codepoint2name for test_xmlcharnamereplace()
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_codeccallbacks.py8
1 files changed, 1 insertions, 7 deletions
diff --git a/Lib/test/test_codeccallbacks.py b/Lib/test/test_codeccallbacks.py
index f7a07ee..5c7243a 100644
--- a/Lib/test/test_codeccallbacks.py
+++ b/Lib/test/test_codeccallbacks.py
@@ -37,12 +37,6 @@ class CodecCallbackTest(unittest.TestCase):
def test_xmlcharnamereplace(self):
# This time use a named character entity for unencodable
# characters, if one is available.
- names = {}
- for (key, value) in htmlentitydefs.entitydefs.items():
- if len(value)==1:
- names[unicode(value, "latin-1")] = unicode(key, "latin-1")
- else:
- names[unichr(int(value[2:-1]))] = unicode(key, "latin-1")
def xmlcharnamereplace(exc):
if not isinstance(exc, UnicodeEncodeError):
@@ -50,7 +44,7 @@ class CodecCallbackTest(unittest.TestCase):
l = []
for c in exc.object[exc.start:exc.end]:
try:
- l.append(u"&%s;" % names[c])
+ l.append(u"&%s;" % htmlentitydefs.codepoint2name[ord(c)])
except KeyError:
l.append(u"&#%d;" % ord(c))
return (u"".join(l), exc.end)