[Python-checkins] python/dist/src/Lib/test test_codeccallbacks.py,1.10,1.11
doerwalter@users.sourceforge.net
doerwalter@users.sourceforge.net
Tue, 29 Apr 2003 13:59:58 -0700
Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1:/tmp/cvs-serv3201/Lib/test
Modified Files:
test_codeccallbacks.py
Log Message:
Use the new htmlentitydefs.codepoint2name for test_xmlcharnamereplace()
Index: test_codeccallbacks.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_codeccallbacks.py,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** test_codeccallbacks.py 19 Feb 2003 02:35:05 -0000 1.10
--- test_codeccallbacks.py 29 Apr 2003 20:59:55 -0000 1.11
***************
*** 38,47 ****
# 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):
--- 38,41 ----
***************
*** 51,55 ****
for c in exc.object[exc.start:exc.end]:
try:
! l.append(u"&%s;" % names[c])
except KeyError:
l.append(u"&#%d;" % ord(c))
--- 45,49 ----
for c in exc.object[exc.start:exc.end]:
try:
! l.append(u"&%s;" % htmlentitydefs.codepoint2name[ord(c)])
except KeyError:
l.append(u"&#%d;" % ord(c))