MCPcopy Create free account
hub / github.com/NSLS2/PyXRF / test_RawHDF5Dataset

Function test_RawHDF5Dataset

pyxrf/core/tests/test_map_processing.py:146–164  ·  view source on GitHub ↗

Class RawHDF5Dataset

(tmpdir)

Source from the content-addressed store, hash-verified

144
145
146def test_RawHDF5Dataset(tmpdir):
147 """Class RawHDF5Dataset"""
148 dir_list, fln, dset = ("dir1", "dir2"), "tmp.txt", "/some/dataset"
149 file_dir = os.path.join(tmpdir, *dir_list)
150 os.makedirs(file_dir, exist_ok=True)
151 os.chdir(file_dir)
152 # Create file
153 with open(fln, "w"):
154 pass
155
156 # 'fln' should be converted to absolute
157 # 'shape' is set to some arbitrary valid tuple
158 rds = RawHDF5Dataset(fln, dset, shape=(10, 50))
159
160 assert os.path.isabs(rds.abs_path), "Path was not successfully converted to absolute path"
161 # If file exists, then the file name was correctly set
162 assert os.path.exists(rds.abs_path), "Path was not correctly set"
163 assert rds.dset_name == dset, "Dataset name was not currectly set"
164 assert rds.shape == (10, 50), "Attribute 'shape' was not set correctly"
165
166
167# fmt: off

Callers

nothing calls this directly

Calls 1

RawHDF5DatasetClass · 0.90

Tested by

no test coverage detected