def test_unpickle_gpuarray_as_numpy_ndarray_flag0():
 oldflag = config.experimental.unpickle_gpu_on_cpu
 config.experimental.unpickle_gpu_on_cpu = False
 try:
  testfile_dir = os.path.dirname(os.path.realpath(__file__))
  fname = 'GpuArray.pkl'
  with open(os.path.join(testfile_dir, fname), 'rb') as fp:
   if PY3:
    u = CompatUnpickler(fp, encoding='latin1')
   else:
    u = CompatUnpickler(fp)
   mat = u.load()
   assert isinstance(mat, pygpu.gpuarray.GpuArray)
   assert (numpy.asarray(mat)[0] == (-42.0))
 finally:
  config.experimental.unpickle_gpu_on_cpu = oldflag

def test_unpickle_gpuarray_as_numpy_ndarray_flag0 ( ) : oldflag = config . experimental . unpickle_gpu_on_cpu config . experimental . unpickle_gpu_on_cpu = False try : testfile_dir = os . path . dirname ( os . path . realpath ( __file__ ) ) fname = 'GpuArray.pkl' with open ( os . path . join ( testfile_dir , fname ) , 'rb' ) as fp : if PY3 : u = CompatUnpickler ( fp , encoding = 'latin1' ) else : u = CompatUnpickler ( fp ) mat = u . load ( ) assert isinstance ( mat , pygpu . gpuarray . GpuArray ) assert ( numpy . asarray ( mat ) [ 0 ] == ( - 42.0 ) ) finally : config . experimental . unpickle_gpu_on_cpu = oldflag
test when pygpu isnt there for unpickle are in test_pickle .