Skip to content

Commit 571be9f

Browse files
committed
added btree v2 test but skipping it (#137)
1 parent 3cbc35d commit 571be9f

File tree

2 files changed

+41
-3
lines changed

2 files changed

+41
-3
lines changed

tests/btreev2.hdf5

70.9 KB
Binary file not shown.

tests/test_chunked.py

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
""" Test pyfive's abililty to read multidimensional datasets. """
22
import os
33

4+
import h5py
45
import numpy as np
6+
import pytest
57
from numpy.testing import assert_array_equal
68

79
import pyfive
@@ -10,11 +12,47 @@
1012
DATASET_CHUNKED_HDF5_FILE = os.path.join(DIRNAME, "data", 'chunked.hdf5')
1113

1214

13-
def test_chunked_dataset():
15+
@pytest.fixture(scope='module')
16+
def data():
17+
return np.array(list(range(10_000)), dtype=np.int32).reshape((100, 100))
1418

15-
with pyfive.File(DATASET_CHUNKED_HDF5_FILE) as hfile:
1619

20+
@pytest.fixture(scope='module')
21+
def name(data):
22+
name = os.path.join(os.path.dirname(__file__), 'btreev2.hdf5')
23+
24+
with h5py.File(name, "w", libver="latest") as f:
25+
# type 10 record - chunked without filters
26+
f.create_dataset(
27+
"btreev2",
28+
data=data,
29+
chunks=(10, 10),
30+
maxshape=(None, None),
31+
dtype="int32")
32+
33+
# type 11 record - chunked with filters
34+
f.create_dataset(
35+
"btreev2_filters",
36+
data=data,
37+
chunks=(10, 10),
38+
maxshape=(None, None),
39+
compression="gzip",
40+
compression_opts=1,
41+
fletcher32=True,
42+
dtype="int32")
43+
44+
return name
45+
46+
47+
def test_chunked_dataset():
48+
with pyfive.File(DATASET_CHUNKED_HDF5_FILE) as hfile:
1749
# check data
1850
dset1 = hfile['dataset1']
19-
assert_array_equal(dset1[:], np.arange(21*16).reshape((21, 16)))
51+
assert_array_equal(dset1[:], np.arange(21 * 16).reshape((21, 16)))
2052
assert dset1.chunks == (2, 2)
53+
54+
@pytest.mark.skip(reason="Not implemented yet, see https://github.com/NCAS-CMS/pyfive/issues/137")
55+
def test_chunked_dataset_btreev2(name, data):
56+
with pyfive.File(name) as hfile:
57+
dset1 = hfile['btreev2']
58+
assert_array_equal(dset1[...], data)

0 commit comments

Comments
 (0)