Exemplo n.º 1
0
    def test_arr_shape(self):
        
        fpath = os.path.join(self.dir_tmp, 'xarr_sh.h5')
        to.arrays_to_h5_fixed(self.arr, 'x', fpath)

        with h5py.File(fpath, 'r') as h:
            assert_list_equal(h.keys(), ['x'])
            assert_equal(2, len(h['x']))
            for x, y in zip(self.arr, h['x'][:]):
                assert_equal(x.shape, y.shape)
Exemplo n.º 2
0
    def test_arr_shape(self):

        fpath = os.path.join(self.dir_tmp, 'xarr_sh.h5')
        to.arrays_to_h5_fixed(self.arr, 'x', fpath)

        with h5py.File(fpath, 'r') as h:
            assert_list_equal(h.keys(), ['x'])
            assert_equal(2, len(h['x']))
            for x, y in zip(self.arr, h['x'][:]):
                assert_equal(x.shape, y.shape)
Exemplo n.º 3
0
 def test_arr_single(self):
     
     # use the module and test it
     fpath = os.path.join(self.dir_tmp, 'xarr1.h5')
     to.arrays_to_h5_fixed([self.arr[0]], 'x', fpath)
     
     with h5py.File(fpath, 'r') as h:
         assert_list_equal(h.keys(), ['x'])
         assert_equal(1, len(h['x']))  
         assert_true(np.all(self.arr[0]==h['x'][:]))
Exemplo n.º 4
0
    def test_arr_single(self):

        # use the module and test it
        fpath = os.path.join(self.dir_tmp, 'xarr1.h5')
        to.arrays_to_h5_fixed([self.arr[0]], 'x', fpath)

        with h5py.File(fpath, 'r') as h:
            assert_list_equal(h.keys(), ['x'])
            assert_equal(1, len(h['x']))
            assert_true(np.all(self.arr[0] == h['x'][:]))