mirror of
https://github.com/python/cpython.git
synced 2025-08-30 13:38:43 +00:00
Test some Unicode pickling endcases.
This commit is contained in:
parent
a31b4ef7c5
commit
8b74b15b92
1 changed files with 12 additions and 0 deletions
|
@ -138,6 +138,18 @@ def dotest(pickle):
|
|||
else:
|
||||
print "accepted insecure string: %s" % repr(buf)
|
||||
|
||||
# Test some Unicode end cases
|
||||
endcases = [u'', u'<\\u>', u'<\\\u1234>', u'<\n>', u'<\\>']
|
||||
for u in endcases:
|
||||
try:
|
||||
u2 = pickle.loads(pickle.dumps(u))
|
||||
except Exception, msg:
|
||||
print "Endcase exception: %s => %s(%s)" % \
|
||||
(`u`, msg.__class__.__name__, str(msg))
|
||||
else:
|
||||
if u2 != u:
|
||||
print "Endcase failure: %s => %s" % (`u`, `u2`)
|
||||
|
||||
|
||||
import pickle
|
||||
dotest(pickle)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue