def test_fnpickling_many(tmpdir):
 from ....tests.helper import pytest
 fn = str(tmpdir.join('test3.pickle'))
 obj3 = 328.3432
 obj4 = 'blahblahfoo'
 fnpickle(obj3, fn)
 fnpickle(obj4, fn, append=True)
 res = fnunpickle(fn, number=(-1))
 assert (len(res) == 2)
 assert (res[0] == obj3)
 assert (res[1] == obj4)
 fnpickle(obj4, fn, append=True)
 res = fnunpickle(fn, number=2)
 assert (len(res) == 2)
 with pytest.raises(EOFError):
  fnunpickle(fn, number=5)

def test_fnpickling_many ( tmpdir ) : from ... . tests . helper import pytest fn = str ( tmpdir . join ( 'test3.pickle' ) ) obj3 = 328.3432 obj4 = 'blahblahfoo' fnpickle ( obj3 , fn ) fnpickle ( obj4 , fn , append = True ) res = fnunpickle ( fn , number = ( - 1 ) ) assert ( len ( res ) == 2 ) assert ( res [ 0 ] == obj3 ) assert ( res [ 1 ] == obj4 ) fnpickle ( obj4 , fn , append = True ) res = fnunpickle ( fn , number = 2 ) assert ( len ( res ) == 2 ) with pytest . raises ( EOFError ) : fnunpickle ( fn , number = 5 )
tests the fnpickle and fnupickle functions ability to pickle and unpickle multiple objects from a single file .