def test_pickle_indexed_table(protocol):
 t = simple_table()
 t.add_index('a')
 t.add_index(['a', 'b'])
 ts = pickle.dumps(t)
 tp = pickle.loads(ts)
 assert (len(t.indices) == len(tp.indices))
 for (index, indexp) in zip(t.indices, tp.indices):
  assert np.all((index.data.data == indexp.data.data))
  assert (index.data.data.colnames == indexp.data.data.colnames)

def test_pickle_indexed_table ( protocol ) : t = simple_table ( ) t . add_index ( 'a' ) t . add_index ( [ 'a' , 'b' ] ) ts = pickle . dumps ( t ) tp = pickle . loads ( ts ) assert ( len ( t . indices ) == len ( tp . indices ) ) for ( index , indexp ) in zip ( t . indices , tp . indices ) : assert np . all ( ( index . data . data == indexp . data . data ) ) assert ( index . data . data . colnames == indexp . data . data . colnames )
ensure that any indices that have been added will survive pickling .