All Downloads are FREE. Search and download functionalities are using the official Maven repository.

bugtests.test325.py Maven / Gradle / Ivy

Go to download

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.

There is a newer version: 2.7.4
Show newest version
"""
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()





© 2015 - 2024 Weber Informatics LLC | Privacy Policy