Skip to content

Commit

Permalink
Removing some code duplication.
Browse files Browse the repository at this point in the history
  • Loading branch information
christian-oreilly committed Nov 15, 2024
1 parent d6a97e8 commit 4df09b2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 22 deletions.
2 changes: 1 addition & 1 deletion pylossless/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def pipeline_fixture():
@pytest.fixture(scope="session")
@pytest.mark.filterwarnings("ignore:Converting data files to EDF format")
def bids_dataset_fixture(tmpdir_factory):
"""Make sure MNE's annotate_break function can run."""
"""Returns a BIDS path for a test recording."""
def edf_import_fct(path_in):
# read in a file
raw = mne.io.read_raw_edf(path_in, preload=True)
Expand Down
24 changes: 3 additions & 21 deletions pylossless/tests/test_bids.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,6 @@


@pytest.mark.filterwarnings("ignore:Converting data files to EDF format")
def test_convert_dataset_to_bids(tmp_path):
"""Make sure MNE's annotate_break function can run."""
def edf_import_fct(path_in):
# read in a file
raw = mne.io.read_raw_edf(path_in, preload=True)
print(raw.annotations)
return raw, np.array([[0, 0, 0]]), {"test": 0, "T0": 1, "T1": 2, "T2": 3}

testing_path = mne.datasets.testing.data_path()
fname = testing_path / "EDF" / "test_edf_overlapping_annotations.edf"
import_args = [{"path_in": fname}]
bids_path_args = [{'subject': '001', 'run': '01', 'session': '01',
"task": "test"}]
ll.bids.convert_dataset_to_bids(
edf_import_fct,
import_args,
bids_path_args,
bids_root=tmp_path / "bids_dataset",
overwrite=True
)
shutil.rmtree(tmp_path / "bids_dataset")
def test_convert_dataset_to_bids(bids_dataset_fixture):
"""Test the conversion of a recording to a BIDS dataset."""
shutil.rmtree(bids_dataset_fixture.root)

0 comments on commit 4df09b2

Please sign in to comment.