def test_fnpickling_simple(tmpdir):
 fn = str(tmpdir.join('test1.pickle'))
 obj1 = 'astring'
 fnpickle(obj1, fn)
 res = fnunpickle(fn)
 assert (obj1 == res)
 fnpickle(obj1, fn, usecPickle=False)
 res = fnunpickle(fn, usecPickle=False)
 assert (obj1 == res)
 with open(fn, 'wb') as f:
  fnpickle(obj1, f)
 with open(fn, 'rb') as f:
  res = fnunpickle(f)
  assert (obj1 == res)
 with open(fn, 'wb') as f:
  fnpickle(obj1, f, usecPickle=False)
 with open(fn, 'rb') as f:
  res = fnunpickle(f, usecPickle=False)
  assert (obj1 == res)

def test_fnpickling_simple ( tmpdir ) : fn = str ( tmpdir . join ( 'test1.pickle' ) ) obj1 = 'astring' fnpickle ( obj1 , fn ) res = fnunpickle ( fn ) assert ( obj1 == res ) fnpickle ( obj1 , fn , usecPickle = False ) res = fnunpickle ( fn , usecPickle = False ) assert ( obj1 == res ) with open ( fn , 'wb' ) as f : fnpickle ( obj1 , f ) with open ( fn , 'rb' ) as f : res = fnunpickle ( f ) assert ( obj1 == res ) with open ( fn , 'wb' ) as f : fnpickle ( obj1 , f , usecPickle = False ) with open ( fn , 'rb' ) as f : res = fnunpickle ( f , usecPickle = False ) assert ( obj1 == res )
tests the fnpickle and fnupickle functions basic operation by pickling and unpickling a string .