Esempio n. 1
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()
Esempio n. 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()
Esempio n. 3
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()
Esempio n. 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()