bugtests.test325.py Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jython Show documentation
Show all versions of jython Show documentation
Jython is an implementation of the high-level, dynamic, object-oriented
language Python written in 100% Pure Java, and seamlessly integrated with
the Java platform. It thus allows you to run Python on any Java platform.
"""
Verify a bug in pickle reported by mailling list.
"""
import support
# This program failed with pickle due to the id() problem.
import pickle
pfile=open("test325.out","wb")
p=pickle.Pickler(pfile)
for l in range (1,10000):
row=[str(l),str(l)]
p.dump(row)
pfile.close()
#print "reading"
n=1
try:
pfile=open("test325.out","rb")
l=pickle.load(pfile)
while l:
comp = [str(n),str(n)]
if l != comp:
print "Pickle error"
print str(l) + " should be " + str(comp)
raise support.TestError("pickle is not working")
n=n+1
l=pickle.load(pfile)
pfile.close()
except EOFError:
#print "End reached, well done"
pfile.close()