@@ -299,27 +299,29 @@ def test_ace(tmpdir):
299
299
f2 .flush ()
300
300
f2 .close ()
301
301
302
+
302
303
@mark .parametrize ("num_files" , [1 , 3 ])
303
304
@mark .parametrize ("tile_embed" , [True , False ])
304
305
@mark .parametrize ("batch_size" , [1 , 5 ])
305
306
def test_hdf5_with_and_without_caching (num_files , tile_embed , batch_size , tmpdir ):
306
307
"""This test ensures that the output from the get of the HDF5 dataset is the same
307
308
when the dataset is loaded with and without caching."""
309
+
308
310
# set up necessary files
309
311
_ = write_sample_npy_files (True , True , tmpdir , num_files )
310
312
files = {}
311
313
files ["pos" ] = sorted (glob .glob (join (tmpdir , "coords*" )))
312
314
files ["z" ] = sorted (glob .glob (join (tmpdir , "embed*" )))
313
315
files ["y" ] = sorted (glob .glob (join (tmpdir , "energy*" )))
314
316
files ["neg_dy" ] = sorted (glob .glob (join (tmpdir , "forces*" )))
315
-
317
+
316
318
write_as_hdf5 (files , join (tmpdir , "test.hdf5" ), tile_embed )
317
319
# Assert file is present in the disk
318
320
assert os .path .isfile (join (tmpdir , "test.hdf5" )), "HDF5 file was not created"
319
321
320
- data = HDF5 (join (tmpdir , "test.hdf5" ), dataset_preload_limit = 0 ) # no caching
321
- data_cached = HDF5 (join (tmpdir , "test.hdf5" ), dataset_preload_limit = 256 ) # caching
322
- assert len (data ) == len (data_cached ), "Number of samples does not match"
322
+ data = HDF5 (join (tmpdir , "test.hdf5" ), dataset_preload_limit = 0 ) # no caching
323
+ data_cached = HDF5 (join (tmpdir , "test.hdf5" ), dataset_preload_limit = 256 ) # caching
324
+ assert len (data ) == len (data_cached ), "Number of samples does not match"
323
325
324
326
dl = DataLoader (data , batch_size )
325
327
dl_cached = DataLoader (data_cached , batch_size )
0 commit comments