def test_fnpickling_protocol(tmpdir):
 import pickle
 obj1 = 'astring'
 obj2 = ToBePickled(obj1)
 for p in range((pickle.HIGHEST_PROTOCOL + 1)):
  fn = str(tmpdir.join('testp{}.pickle'.format(p)))
  fnpickle(obj2, fn, protocol=p)
  res = fnunpickle(fn)
  assert (res == obj2)

def test_fnpickling_protocol ( tmpdir ) : import pickle obj1 = 'astring' obj2 = ToBePickled ( obj1 ) for p in range ( ( pickle . HIGHEST_PROTOCOL + 1 ) ) : fn = str ( tmpdir . join ( 'testp{}.pickle' . format ( p ) ) ) fnpickle ( obj2 , fn , protocol = p ) res = fnunpickle ( fn ) assert ( res == obj2 )
tests the fnpickle and fnupickle functions ability to pickle and unpickle pickle files from all protcols .