mirror of
https://github.com/python/cpython.git
synced 2025-09-14 20:56:06 +00:00
Backport r57105 and r57145 from the py3k branch: UTF-32 codecs.
This commit is contained in:
parent
437e6a3b15
commit
6e39080649
12 changed files with 999 additions and 2 deletions
|
@ -285,7 +285,8 @@ class CodecCallbackTest(unittest.TestCase):
|
|||
|
||||
def test_longstrings(self):
|
||||
# test long strings to check for memory overflow problems
|
||||
errors = [ "strict", "ignore", "replace", "xmlcharrefreplace", "backslashreplace"]
|
||||
errors = [ "strict", "ignore", "replace", "xmlcharrefreplace",
|
||||
"backslashreplace"]
|
||||
# register the handlers under different names,
|
||||
# to prevent the codec from recognizing the name
|
||||
for err in errors:
|
||||
|
@ -293,7 +294,8 @@ class CodecCallbackTest(unittest.TestCase):
|
|||
l = 1000
|
||||
errors += [ "test." + err for err in errors ]
|
||||
for uni in [ s*l for s in (u"x", u"\u3042", u"a\xe4") ]:
|
||||
for enc in ("ascii", "latin-1", "iso-8859-1", "iso-8859-15", "utf-8", "utf-7", "utf-16"):
|
||||
for enc in ("ascii", "latin-1", "iso-8859-1", "iso-8859-15",
|
||||
"utf-8", "utf-7", "utf-16", "utf-32"):
|
||||
for err in errors:
|
||||
try:
|
||||
uni.encode(enc, err)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue