diff options
author | Tim Peters <tim.peters@gmail.com> | 2001-04-09 17:16:31 (GMT) |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2001-04-09 17:16:31 (GMT) |
commit | c58440fcef587cb749a937283b95f2b51ad58b9f (patch) | |
tree | 84264d44dc2281886b5775f2aa7549e619595242 | |
parent | a830b3859baafd78964f98c7587b3bd7da6ba6ae (diff) | |
download | cpython-c58440fcef587cb749a937283b95f2b51ad58b9f.zip cpython-c58440fcef587cb749a937283b95f2b51ad58b9f.tar.gz cpython-c58440fcef587cb749a937283b95f2b51ad58b9f.tar.bz2 |
No functional change -- just added whitespace in places so I could follow
the logic better. Will be adding some additional tests later today.
-rw-r--r-- | Lib/test/pickletester.py | 41 |
1 files changed, 30 insertions, 11 deletions
diff --git a/Lib/test/pickletester.py b/Lib/test/pickletester.py index 90883e2..648547b 100644 --- a/Lib/test/pickletester.py +++ b/Lib/test/pickletester.py @@ -57,31 +57,49 @@ def dotest(pickle): x.append(5) r = [] r.append(r) + print "dumps()" s = pickle.dumps(x) + print "loads()" x2 = pickle.loads(s) - if x2 == x: print "ok" - else: print "bad" + if x2 == x: + print "ok" + else: + print "bad" + print "loads() DATA" x2 = pickle.loads(DATA) - if x2 == x: print "ok" - else: print "bad" + if x2 == x: + print "ok" + else: + print "bad" + print "dumps() binary" s = pickle.dumps(x, 1) + print "loads() binary" x2 = pickle.loads(s) - if x2 == x: print "ok" - else: print "bad" + if x2 == x: + print "ok" + else: + print "bad" + print "loads() BINDATA" x2 = pickle.loads(BINDATA) - if x2 == x: print "ok" - else: print "bad" - s = pickle.dumps(r) + if x2 == x: + print "ok" + else: + print "bad" + print "dumps() RECURSIVE" + s = pickle.dumps(r) x2 = pickle.loads(s) - if x2 == r: print "ok" - else: print "bad" + if x2 == r: + print "ok" + else: + print "bad" + # don't create cyclic garbage del x2[0] del r[0] @@ -97,6 +115,7 @@ def dotest(pickle): pass else: print "dump to closed file should raise ValueError" + f = open(fn, "r") f.close() try: |