diff options
Diffstat (limited to 'Lib/test/test_pickle.py')
-rw-r--r-- | Lib/test/test_pickle.py | 12 |
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) |