summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_pickle.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2000-12-19 02:01:12 (GMT)
committerGuido van Rossum <guido@python.org>2000-12-19 02:01:12 (GMT)
commit8b74b15b9283bea63a194e71b5c88af5dc6f497d (patch)
tree6e2a6b5713b2e85fdcfa3f8cb935055f3fb33933 /Lib/test/test_pickle.py
parenta31b4ef7c526b7f17620024248d11a631ef59644 (diff)
downloadcpython-8b74b15b9283bea63a194e71b5c88af5dc6f497d.zip
cpython-8b74b15b9283bea63a194e71b5c88af5dc6f497d.tar.gz
cpython-8b74b15b9283bea63a194e71b5c88af5dc6f497d.tar.bz2
Test some Unicode pickling endcases.
Diffstat (limited to 'Lib/test/test_pickle.py')
-rw-r--r--Lib/test/test_pickle.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_pickle.py b/Lib/test/test_pickle.py
index 85a6daa..c14daf4 100644
--- a/Lib/test/test_pickle.py
+++ b/Lib/test/test_pickle.py
@@ -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)