<s> import pickle <EOL> from cStringIO import StringIO <EOL> from test import test_support <EOL> from test . pickletester import ( AbstractPickleTests , <EOL> AbstractPickleModuleTests , <EOL> AbstractPersistentPicklerTests , <EOL> AbstractPicklerUnpicklerObjectTests , <EOL> BigmemPickleTests ) <EOL> class PickleTests ( AbstractPickleTests , AbstractPickleModuleTests ) : <EOL> def dumps ( self , arg , proto = <NUM_LIT:0> , fast = <NUM_LIT:0> ) : <EOL> return pickle . dumps ( arg , proto ) <EOL> def loads ( self , buf ) : <EOL> return pickle . loads ( buf ) <EOL> module = pickle <EOL> error = KeyError <EOL> class PicklerTests ( AbstractPickleTests ) : <EOL> error = KeyError <EOL> def dumps ( self , arg , proto = <NUM_LIT:0> , fast = <NUM_LIT:0> ) : <EOL> f = StringIO ( ) <EOL> p = pickle . Pickler ( f , proto ) <EOL> if fast : <EOL> p . fast = fast <EOL> p . dump ( arg ) <EOL> f . seek ( <NUM_LIT:0> ) <EOL> return f . read ( ) <EOL> def loads ( self , buf ) : <EOL> f = StringIO ( buf ) <EOL> u = pickle . Unpickler ( f ) <EOL> return u . load ( ) <EOL> class PersPicklerTests ( AbstractPersistentPicklerTests ) : <EOL> def dumps ( self , arg , proto = <NUM_LIT:0> , fast = <NUM_LIT:0> ) : <EOL> class PersPickler ( pickle . Pickler ) : <EOL> def persistent_id ( subself , obj ) : <EOL> return self . persistent_id ( obj ) <EOL> f = StringIO ( ) <EOL> p = PersPickler ( f , proto ) <EOL> if fast : <EOL> p . fast = fast <EOL> p . dump ( arg ) <EOL> f . seek ( <NUM_LIT:0> ) <EOL> return f . read ( ) <EOL> def loads ( self , buf ) : <EOL> class PersUnpickler ( pickle . Unpickler ) : <EOL> def persistent_load ( subself , obj ) : <EOL> return self . persistent_load ( obj ) <EOL> f = StringIO ( buf ) <EOL> u = PersUnpickler ( f ) <EOL> return u . load ( ) <EOL> class PicklerUnpicklerObjectTests ( AbstractPicklerUnpicklerObjectTests ) : <EOL> pickler_class = pickle . Pickler <EOL> unpickler_class = pickle . Unpickler <EOL> class PickleBigmemPickleTests ( BigmemPickleTests ) : <EOL> def dumps ( self , arg , proto = <NUM_LIT:0> , fast = <NUM_LIT:0> ) : <EOL> return pickle . dumps ( arg , proto ) <EOL> def loads ( self , buf ) : <EOL> return pickle . loads ( buf ) <EOL> def test_main ( ) : <EOL> test_support . run_unittest ( <EOL> PickleTests , <EOL> PicklerTests , <EOL> PersPicklerTests , <EOL> PicklerUnpicklerObjectTests , <EOL> PickleBigmemPickleTests , <EOL> ) <EOL> test_support . run_doctest ( pickle ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> test_main ( ) </s>
