mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
refactored the unicodeobject/ucnhash interface, to hide the
implementation details inside the ucnhash module. also cleaned up the unicode copyright blurb a little; Secret Labs' internal revision history isn't that interesting...
This commit is contained in:
parent
a2bf2709b3
commit
0fdb90cafe
4 changed files with 144 additions and 208 deletions
|
@ -50,16 +50,6 @@ print "done."
|
|||
|
||||
# strict error testing:
|
||||
print "Testing unicode character name expansion strict error handling....",
|
||||
k_cchMaxUnicodeName = 83
|
||||
|
||||
s = "\N{" + "1" * (k_cchMaxUnicodeName + 2) + "}"
|
||||
try:
|
||||
unicode(s, 'unicode-escape', 'strict')
|
||||
except UnicodeError:
|
||||
pass
|
||||
else:
|
||||
raise AssertionError, "failed to raise an exception when presented " \
|
||||
"with a UCN > k_cchMaxUnicodeName"
|
||||
try:
|
||||
unicode("\N{blah}", 'unicode-escape', 'strict')
|
||||
except UnicodeError:
|
||||
|
@ -67,6 +57,14 @@ except UnicodeError:
|
|||
else:
|
||||
raise AssertionError, "failed to raise an exception when given a bogus character name"
|
||||
|
||||
try:
|
||||
unicode("\N{" + "x" * 100000 + "}", 'unicode-escape', 'strict')
|
||||
except UnicodeError:
|
||||
pass
|
||||
else:
|
||||
raise AssertionError, "failed to raise an exception when given a very " \
|
||||
"long bogus character name"
|
||||
|
||||
try:
|
||||
unicode("\N{SPACE", 'unicode-escape', 'strict')
|
||||
except UnicodeError:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue