<s> from statsmodels . compat . python import lrange , BytesIO <EOL> from statsmodels . iolib . smpickle import save_pickle , load_pickle <EOL> def test_pickle ( ) : <EOL> import tempfile <EOL> from numpy . testing import assert_equal <EOL> tmpdir = tempfile . mkdtemp ( prefix = '<STR_LIT>' ) <EOL> a = lrange ( <NUM_LIT:10> ) <EOL> save_pickle ( a , tmpdir + '<STR_LIT>' ) <EOL> b = load_pickle ( tmpdir + '<STR_LIT>' ) <EOL> assert_equal ( a , b ) <EOL> try : <EOL> import os <EOL> os . remove ( tmpdir + '<STR_LIT>' ) <EOL> os . rmdir ( tmpdir ) <EOL> except ( OSError , IOError ) : <EOL> pass <EOL> assert not os . path . exists ( tmpdir ) <EOL> fh = BytesIO ( ) <EOL> save_pickle ( a , fh ) <EOL> fh . seek ( <NUM_LIT:0> , <NUM_LIT:0> ) <EOL> c = load_pickle ( fh ) <EOL> fh . close ( ) <EOL> assert_equal ( a , b ) </s>
