def test_to_hdf5(self): # setup HDF5 file tf = tempfile.NamedTemporaryFile(delete=False) file_path = tf.name tf.close() # setup genotype array node_path = 'test' g = GenotypeCArray(diploid_genotype_data, dtype='i1') # write using file path and node path g.to_hdf5(file_path, node_path) # test outcome with h5py.File(file_path, mode='r') as h5f: h5d = h5f[node_path] aeq(g[:], h5d[:]) # write using group with h5py.File(file_path, mode='w') as h5f: g.to_hdf5(h5f, node_path) # test outcome with h5py.File(file_path, mode='r') as h5f: h5d = h5f[node_path] aeq(g[:], h5d[:])