示例#1
0
文件: test_h5py.py 项目: MoherX/odo
def test_create_partially_present_dataset():
    with tmpfile('.hdf5') as fn:
        ds1 = datashape.dshape('{x: int32}')
        f = create(h5py.File, dshape=ds1, path=fn)

        ds2 = datashape.dshape('{x: int32, y: 5 * int32}')
        f2 = create(h5py.File, dshape=ds2, path=fn)

        try:
            assert f.filename == f2.filename
            assert list(f.keys()) == list(f2.keys())
            assert f['y'].dtype == 'i4'
        finally:
            f.close()
            f2.close()
示例#2
0
def test_create_partially_present_dataset():
    with tmpfile('.hdf5') as fn:
        ds1 = datashape.dshape('{x: int32}')
        f = create(h5py.File, dshape=ds1, path=fn)

        ds2 = datashape.dshape('{x: int32, y: 5 * int32}')
        f2 = create(h5py.File, dshape=ds2, path=fn)

        try:
            assert f.filename == f2.filename
            assert list(f.keys()) == list(f2.keys())
            assert f['y'].dtype == 'i4'
        finally:
            f.close()
            f2.close()
示例#3
0
文件: test_h5py.py 项目: MoherX/odo
def test_create():
    with tmpfile('.hdf5') as fn:
        ds = datashape.dshape('{x: int32, y: {z: 3 * int32}}')
        f = create(h5py.File, dshape='{x: int32, y: {z: 3 * int32}}', path=fn)
        try:
            assert isinstance(f, h5py.File)
            assert f.filename == fn
            assert discover(f) == ds
        finally:
            f.close()
示例#4
0
def test_create():
    with tmpfile('.hdf5') as fn:
        ds = datashape.dshape('{x: int32, y: {z: 3 * int32}}')
        f = create(h5py.File, dshape='{x: int32, y: {z: 3 * int32}}', path=fn)
        try:
            assert isinstance(f, h5py.File)
            assert f.filename == fn
            assert discover(f) == ds
        finally:
            f.close()