Skip to content

Commit

Permalink
tests: add test
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmueller committed Feb 28, 2019
1 parent e13f689 commit 7dadd1f
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/test_series_hdf5_qpimage.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,31 @@ def test_subjoined_load_data():
pass


def test_subjoined_meta_extraction():
path = datapath / "single_qpimage.h5"
tf = tempfile.mktemp(suffix=".h5", prefix="qpformat_test_")
qpi = qpimage.QPImage(h5file=path, h5mode="r")

# generate subjoined qpseries hdf5 file
with h5py.File(tf, mode="w") as h5:
qps = h5.require_group("qpseries")
qpimage.QPSeries(qpimage_list=[qpi, qpi],
h5file=qps,
meta_data={"wavelength": 111e-9,
"pixel size": .12})

ds = qpformat.load_data(tf)

assert ds.meta_data["wavelength"] == 111e-9
assert ds.meta_data["pixel size"] == .12

# cleanup
try:
os.remove(tf)
except OSError:
pass


if __name__ == "__main__":
# Run all tests
loc = locals()
Expand Down

0 comments on commit 7dadd1f

Please sign in to comment.