From 8b74b15b9283bea63a194e71b5c88af5dc6f497d Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Tue, 19 Dec 2000 02:01:12 +0000 Subject: Test some Unicode pickling endcases. --- Lib/test/test_pickle.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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) -- cgit v0.12