diff --git a/src/spikegadgets_to_nwb/tests/test_convert_ephys.py b/src/spikegadgets_to_nwb/tests/test_convert_ephys.py index 5ccb89a..6dc2fe7 100644 --- a/src/spikegadgets_to_nwb/tests/test_convert_ephys.py +++ b/src/spikegadgets_to_nwb/tests/test_convert_ephys.py @@ -1,6 +1,7 @@ import os import pynwb -from spikegadgets_to_nwb.convert_ephys import add_raw_ephys +import warnings +from spikegadgets_to_nwb.convert_ephys import add_raw_ephys, RecFileDataChunkIterator from spikegadgets_to_nwb import convert_yaml, convert_rec_header from spikegadgets_to_nwb.tests.test_convert_rec_header import default_test_xml_tree @@ -273,5 +274,34 @@ def test_add_raw_ephys_two_epoch(): ) == old_nwbfile.acquisition["e-series"].data[:, 0] ).all() - + # check the timestamps match + assert ( + read_nwbfile.acquisition["e-series"].timestamps[:] + == old_nwbfile.acquisition["e-series"].timestamps[:] + ).all() os.remove(filename) + + +def test_misordered_rec_warning(): + # load rec files in wrong order + try: + # running on github + recfile = [ + os.environ.get("DOWNLOAD_DIR") + "/20230622_160016.rec", + os.environ.get("DOWNLOAD_DIR") + "/20230622_155936.rec", + ] + rec_to_nwb_file = os.environ.get("DOWNLOAD_DIR") + "/minirec20230622_.nwb" + except (TypeError, FileNotFoundError): + # running locally + recfile = [ + path + "/test_data/20230622_160016.rec", + path + "/test_data/20230622_155936.rec", + ] + # TODO: run this test once the timesmps loading is fixed + # with warnings.catch_warnings(record=True) as w: + # warnings.simplefilter("always") + # # warnings.warn("abc") + # RecFileDataChunkIterator( + # recfile, + # ) + # assert len(w) == 1